diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..d92eff1f --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +VOUCHERIFY_HOST=https://api.voucherify.io +X_APP_ID= +X_APP_TOKEN= diff --git a/.gitignore b/.gitignore index 49c54a4f..994a1bd8 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,10 @@ nosetests.xml coverage.xml *,cover .hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache # Translations *.mo @@ -61,5 +65,13 @@ target/ #Ipython Notebook .ipynb_checkpoints -# Jetbrains work directory -.idea +#Other +/.github/ +/.openapi-generator/ +/test/ +/.gitlab-ci.yml +/.openapi-generator-ignore +/.travis.yml +/git_push.sh +/.env +/.idea diff --git a/DEPRECATED_CHANGELOG.md b/DEPRECATED_CHANGELOG.md new file mode 100644 index 00000000..bc862dd4 --- /dev/null +++ b/DEPRECATED_CHANGELOG.md @@ -0,0 +1,34 @@ +## Deprecated changelog + +- **2022-04-06** - `2.2.2` + - Added `client.vouchers.releaseValidationSession` method + - Added `client.redemptions.redeemStackable` method + - Added `client.validations.validateStackable` method +- **2021-05-26** - `2.2.1` + - Upload new version to pypi.org. No changes compared to `2.2.0` +- **2021-05-20** - `2.2.0` + - Added `client.validations*` member + - Added method `validateVoucher` to `client.validations` + - Changed default timeout from 500 minutes to 3 minutes. Made timeout configurable + - Bugfix: Fixed raising exception when response json contains property "error" +- **2019-06-19** - `2.1.0` Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region. +- **2018-01-20** - `2.0.0` + - Moved vouchers related methods to `client.vouchers.*` namespace + - Moved redemptions related methods to `client.redemptions.*` namespace + - Moved distributions related methods to `client.distributions.*` namespace + - Renamed `client.customer.*` to `client.customers.*` + - Removed outdated `client.distributions.publish(campaignName)` method interface + - Fixed utils methods to accept vouchers with `None` gift +- **2016-12-02** - `1.4.2` - Support gift vouchers in utils +- **2016-10-04** - `1.4.1` - Publish update +- **2016-07-18** - `1.4.0` - Voucher code pattern +- **2016-07-18** - `1.3.0` - Update voucher +- **2016-06-23** - `1.2.1` - Gift vouchers +- **2016-06-16** - `1.2.0` - Unified naming convention +- **2016-06-16** - `1.1.0` - Added customer methods +- **2016-06-08** - `1.0.0` - Release version +- **2016-05-31** - `0.1.0` - First version: + - Authentication + - Voucher informations: *get*, *usage* + - Voucher operations: *use* + - Utils diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ac56bf4a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Use an official Python runtime as a parent image +FROM python:3.8 + +# Set the working directory in the container +WORKDIR /app + +# Copy only the requirements files first to leverage Docker caching +COPY requirements.txt test-requirements.txt ./ + +# Install dependencies +RUN pip install --no-cache-dir -r requirements.txt && \ + pip install --no-cache-dir -r test-requirements.txt + +# Set up a volume to store data +VOLUME /app/data + +# Copy the rest of the application code +COPY . . + +# Run the application +CMD ["python", "./__tests__/main.py"] diff --git a/ENDPOINTS-COVERAGE.md b/ENDPOINTS-COVERAGE.md new file mode 100644 index 00000000..7354b32b --- /dev/null +++ b/ENDPOINTS-COVERAGE.md @@ -0,0 +1,344 @@ +# Endpoints Coverage + +## Table of Content + +- [Publications](#publications) +- [Qualifications](#qualifications) +- [Validations](#validations) +- [Redemptions](#redemptions) +- [Vouchers](#vouchers) +- [Campaigns](#campaigns) +- [Promotions](#promotions) +- [Rewards](#rewards) +- [Loyalties](#loyalties) +- [Customers](#customers) +- [Orders](#orders) +- [Products](#products) +- [Product Collections](#product-collections) +- [Validation Rules](#validation-rules) +- [Segments](#segments) +- [Events](#events) +- [Async Actions](#async-actions) +- [Exports](#exports) +- [Categories](#categories) +- [Metadata Schemas](#metadata-schemas) +- [Locations](#locations) +- [Referrals](#referrals) +- [Bin](#bin) +- [Templates](#templates) +- [Management](#management) +- [Client-side](#client-side) +# Endpoints + +## Publications +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/publications/create | get | Create Publication | supported | | +| /v1/publications | get | List Publications | supported | | +| /v1/publications | post | Create Publication | supported | | +## Qualifications +| endpoint | method | summary | is supported | is deprecated | +| ------------------ | ------ | ----------------- | ------------------------------------ | ------------- | +| /v1/qualifications | post | Check Eligibility | supported | | +## Validations +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------- | ------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/validations | post | Validate Stackable Discounts | supported | | +| /v1/vouchers/{code}/validate | post | Validate Voucher [Deprecated] | | deprecated | +| /v1/promotions/validation | post | Validate Promotions [Deprecated] | | deprecated | +| /v1/promotions/tiers/{tierId}/validation | post | Validate Promotion Tier [Deprecated] | | deprecated | +## Redemptions +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------- | ------ | ------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/redemptions | get | List Redemptions | supported | | +| /v1/redemptions | post | Redeem Stackable Discounts | supported | | +| /v1/redemptions/{redemptionId} | get | Get Redemption | supported | | +| /v1/vouchers/{code}/redemption | get | Get Voucher's Redemptions | supported | | +| /v1/vouchers/{code}/redemption | post | Redeem Voucher [Deprecated] | | deprecated | +| /v1/redemptions/{redemptionId}/rollback | post | Rollback Redemption | supported | | +| /v1/promotions/tiers/{promotionTierId}/redemption | post | Redeem Promotion [Deprecated] | | deprecated | +| /v1/redemptions/{parentRedemptionId}/rollbacks | post | Rollback Stackable Redemptions | supported | | +## Vouchers +| endpoint | method | summary | is supported | is deprecated | +| ----------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------------------------------ | +| /v1/vouchers | get | List Vouchers | supported | | +| /v1/vouchers | post | Generate Random Code | supported | | +| /v1/vouchers/{code} | get | Get Voucher | supported | | +| /v1/vouchers/{code} | put | Update Voucher | supported | | +| /v1/vouchers/{code} | delete | Delete Voucher | supported | | +| /v1/vouchers/{code} | post | Create Voucher | supported | | +| /v1/vouchers/{code}/enable | post | Enable Voucher | supported | | +| /v1/vouchers/{code}/disable | post | Disable Voucher | supported | | +| /v1/vouchers/{code}/balance | post | Add or Remove Voucher Balance | supported | | +| /v1/vouchers/{code}/transactions | get | List Voucher Transactions | supported | | +| /v1/vouchers/{code}/transactions/export | post | Export Voucher Transactions | supported | | +| /v1/vouchers/import | post | Import Vouchers | supported | | +| /v1/vouchers/importCSV | post | Import Vouchers using CSV | supported | | +| /v1/vouchers/bulk/async | post | Update Vouchers in Bulk | supported | | +| /v1/vouchers/metadata/async | post | Update Vouchers' Metadata in Bulk | supported | | +| /v1/vouchers/{code}/sessions/{sessionKey} | delete | Release Validation Session | supported | | +| /v1/vouchers/qualification | post | Examine Qualification [Deprecated] | | deprecated | +## Campaigns +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------ | ------ | ------------------------------------------ | ------------------------------------ | ------------------------------------ | +| /v1/campaigns | post | Create Campaign | supported | | +| /v1/campaigns | get | List Campaigns | supported | | +| /v1/campaigns/{campaignId} | get | Get Campaign | supported | | +| /v1/campaigns/{campaignId} | put | Update Campaign | supported | | +| /v1/campaigns/{campaignId} | delete | Delete Campaign | supported | | +| /v1/campaigns/{campaignId}/vouchers | post | Add Vouchers to Campaign | supported | | +| /v1/campaigns/{campaignId}/vouchers/{code} | post | Add Voucher with Specific Code to Campaign | supported | | +| /v1/campaigns/{campaignId}/import | post | Import Vouchers to Campaign | supported | | +| /v1/campaigns/{campaignId}/importCSV | post | Import Vouchers to Campaign by CSV | supported | | +| /v1/campaigns/qualification | post | Examine Qualification [Deprecated] | | deprecated | +| /v1/campaigns/{campaignId}/enable | post | Enable Campaign | supported | | +| /v1/campaigns/{campaignId}/disable | post | Disable Campaign | supported | | +## Promotions +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------- | +| /v1/promotions/tiers | get | List Promotion Tiers | supported | | +| /v1/promotions/{campaignId}/tiers | get | List Promotion Tiers from Campaign | supported | | +| /v1/promotions/{campaignId}/tiers | post | Add Promotion Tier to Campaign | supported | | +| /v1/promotions/tiers/{promotionTierId} | get | Get Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId} | put | Update Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId} | delete | Delete Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId}/enable | post | Enable Promotion Tier | supported | | +| /v1/promotions/tiers/{promotionTierId}/disable | post | Disable Promotion Tier | supported | | +| /v1/promotions/stacks | get | List Promotion Stacks | supported | | +| /v1/promotions/{campaignId}/stacks | get | List Promotion Stacks in Campaign | supported | | +| /v1/promotions/{campaignId}/stacks | post | Create Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | get | Get Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | put | Update Promotion Stack | supported | | +| /v1/promotions/{campaignId}/stacks/{stackId} | delete | Delete Promotion Stack | supported | | +## Rewards +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------- | ------ | ------------------------ | ------------------------------------ | ------------- | +| /v1/rewards | get | List Rewards | supported | | +| /v1/rewards | post | Create Reward | supported | | +| /v1/rewards/{rewardId} | get | Get Reward | supported | | +| /v1/rewards/{rewardId} | put | Update Reward | supported | | +| /v1/rewards/{rewardId} | delete | Delete Reward | supported | | +| /v1/rewards/{rewardId}/assignments | get | List Reward Assignments | supported | | +| /v1/rewards/{rewardId}/assignments | post | Create Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | put | Update Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | delete | Delete Reward Assignment | supported | | +| /v1/rewards/{rewardId}/assignments/{assignmentId} | get | Get Reward Assignment | supported | | +## Loyalties +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------- | ------ | ---------------------------------- | ------------------------------------ | ------------- | +| /v1/loyalties | get | List Loyalty Campaigns | supported | | +| /v1/loyalties | post | Create Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | get | Get Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | put | Update Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId} | delete | Delete Loyalty Campaign | supported | | +| /v1/loyalties/{campaignId}/members | get | List Members | supported | | +| /v1/loyalties/{campaignId}/members | post | Add Member | supported | | +| /v1/loyalties/{campaignId}/members/{memberId} | get | Get Member | supported | | +| /v1/loyalties/members/{memberId} | get | Get Member | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/activity | get | List Member Activity | supported | | +| /v1/loyalties/members/{memberId}/activity | get | List Member Activity | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/balance | post | Add or Remove Loyalty Card Balance | supported | | +| /v1/loyalties/members/{memberId}/balance | post | Add or Remove Loyalty Card Balance | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transfers | post | Transfer Loyalty Points | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transactions | get | List Loyalty Card Transactions | supported | | +| /v1/loyalties/members/{memberId}/transactions | get | List Loyalty Card Transactions | supported | | +| /v1/loyalties/members/{memberId}/transactions/export | post | Export Loyalty Card Transactions | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | post | Export Loyalty Card Transactions | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | get | Get Points Expiration | supported | | +| /v1/loyalties/{campaignId}/points-expiration/export | post | Create Points Expiration Export | supported | | +| /v1/loyalties/{campaignId}/earning-rules | get | List Earning Rules | supported | | +| /v1/loyalties/{campaignId}/earning-rules | post | Create Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | get | Get Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | put | Update Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | delete | Delete Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable | post | Enable Earning Rule | supported | | +| /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable | post | Disable Earning Rule | supported | | +| /v1/loyalties/members/{memberId}/rewards | get | List Member Rewards | supported | | +| /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | get | Get Reward Details | supported | | +| /v1/loyalties/{campaignId}/reward-assignments | get | List Reward Assignments | supported | | +| /v1/loyalties/{campaignId}/rewards | get | List Reward Assignments | supported | | +| /v1/loyalties/{campaignId}/rewards | post | Create Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | get | Get Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | get | Get Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | put | Update Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/rewards/{assignmentId} | delete | Delete Reward Assignment | supported | | +| /v1/loyalties/{campaignId}/members/{memberId}/redemption | post | Redeem Reward | supported | | +| /v1/loyalties/members/{memberId}/redemption | post | Redeem Reward | supported | | +| /v1/loyalties/{campaignId}/tiers | get | List Loyalty Tiers | supported | | +| /v1/loyalties/{campaignId}/tiers | post | Create loyalty tiers | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | get | Get Loyalty Tier | supported | | +| /v1/loyalties/members/{memberId}/tiers | get | List Member's Loyalty Tiers | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | get | List Loyalty Tier Earning Rules | supported | | +| /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | get | List Loyalty Tier Rewards | supported | | +## Customers +| endpoint | method | summary | is supported | is deprecated | +| --------------------------------------------- | ------ | ------------------------------------- | ------------------------------------ | ------------------------------------ | +| /v1/customers | get | List Customers | supported | | +| /v1/customers | post | Create Customer | supported | | +| /v1/customers/{customerId} | get | Get Customer | supported | | +| /v1/customers/{customerId} | delete | Delete Customer | supported | | +| /v1/customers/{customerId} | put | Update Customer | supported | | +| /v1/customers/{customerId}/permanent-deletion | post | Delete Customer Permanently | supported | | +| /v1/customers/importCSV | post | Import and Update Customers using CSV | supported | | +| /v1/customers/bulk/async | post | Update Customers in Bulk | supported | | +| /v1/customers/metadata/async | post | Update Customers' Metadata in Bulk | supported | | +| /v1/customers/{customerId}/activity | get | List Customer Activity | supported | | +| /v1/customers/{customerId}/activities | get | List Customer Activities [Deprecated] | | deprecated | +| /v1/customers/{customerId}/segments | get | List Customer's Segments | supported | | +| /v1/customers/{customerId}/redeemables | get | List Customer's Redeemables | supported | | +## Orders +| endpoint | method | summary | is supported | is deprecated | +| -------------------- | ------ | -------------------- | ------------------------------------ | ------------- | +| /v1/orders | get | List Orders | supported | | +| /v1/orders | post | Create Order | supported | | +| /v1/orders/{orderId} | get | Get Order | supported | | +| /v1/orders/{orderId} | put | Update Order | supported | | +| /v1/orders/import | post | Import Orders | supported | | +| /v1/orders/export | post | Create Orders Export | supported | | +## Products +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------- | ------ | --------------------------------- | ------------------------------------ | ------------- | +| /v1/products | get | List Products | supported | | +| /v1/products | post | Create Product | supported | | +| /v1/products/{productId} | get | Get Product | supported | | +| /v1/products/{productId} | put | Update Product | supported | | +| /v1/products/{productId} | delete | Delete Product | supported | | +| /v1/products/bulk/async | post | Update Products in Bulk | supported | | +| /v1/products/metadata/async | post | Update Products' Metadata in Bulk | supported | | +| /v1/skus/{skuId} | get | Get SKU | supported | | +| /v1/products/{productId}/skus | get | List SKUs in Product | supported | | +| /v1/products/{productId}/skus | post | Create SKU | supported | | +| /v1/products/{productId}/skus/{skuId} | put | Update SKU | supported | | +| /v1/products/{productId}/skus/{skuId} | delete | Delete SKU | supported | | +| /v1/products/importCSV | post | Import Products using CSV | supported | | +| /v1/skus/importCSV | post | Import SKUs using CSV | supported | | +## Product Collections +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------ | ------ | --------------------------- | ------------------------------------ | ------------- | +| /v1/product-collections | get | List Product Collections | supported | | +| /v1/product-collections | post | Create Product Collection | supported | | +| /v1/product-collections/{productCollectionId} | get | Get Product Collection | supported | | +| /v1/product-collections/{productCollectionId} | delete | Delete Product Collection | supported | | +| /v1/product-collections/{productCollectionId}/products | get | List Products in Collection | supported | | +## Validation Rules +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------ | ------ | ------------------------------------ | ------------------------------------ | ------------- | +| /v1/validation-rules | get | List Validation Rules | supported | | +| /v1/validation-rules | post | Create Validation Rules | supported | | +| /v1/validation-rules/{validationRuleId} | get | Get Validation Rule | supported | | +| /v1/validation-rules/{validationRuleId} | put | Update Validation Rule | supported | | +| /v1/validation-rules/{validationRuleId} | delete | Delete Validation Rule | supported | | +| /v1/validation-rules-assignments | get | List Validation Rules' Assignment(s) | supported | | +| /v1/validation-rules/{validationRuleId}/assignments | get | List Validation Rule Assignments | supported | | +| /v1/validation-rules/{validationRuleId}/assignments | post | Create Validation Rules Assignments | supported | | +| /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | delete | Delete Validation Rule Assignment | supported | | +## Segments +| endpoint | method | summary | is supported | is deprecated | +| ------------------------ | ------ | -------------- | ------------------------------------ | ------------- | +| /v1/segments/{segmentId} | get | Get Segment | supported | | +| /v1/segments/{segmentId} | delete | Delete Segment | supported | | +| /v1/segments | post | Create Segment | supported | | +## Events +| endpoint | method | summary | is supported | is deprecated | +| ---------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/events | post | Track Custom Event | supported | | +## Async Actions +| endpoint | method | summary | is supported | is deprecated | +| --------------------------------- | ------ | ------------------ | ------------------------------------ | ------------- | +| /v1/async-actions | get | List Async Actions | supported | | +| /v1/async-actions/{asyncActionId} | get | Get Async Action | supported | | +## Exports +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | --------------- | ------------------------------------ | ------------- | +| /v1/exports | post | Create Export | supported | | +| /v1/exports | get | List Exports | supported | | +| /v1/exports/{exportId} | get | Get Export | supported | | +| /v1/exports/{exportId} | delete | Delete Export | supported | | +| /v1/exports/{export_Id} | get | Download Export | supported | | +## Categories +| endpoint | method | summary | is supported | is deprecated | +| --------------------------- | ------ | --------------- | ------------------------------------ | ------------- | +| /v1/categories | get | List Categories | supported | | +| /v1/categories | post | Create Category | supported | | +| /v1/categories/{categoryId} | get | Get Category | supported | | +| /v1/categories/{categoryId} | delete | Delete Category | supported | | +| /v1/categories/{categoryId} | put | Update Category | supported | | +## Metadata Schemas +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------- | ------ | --------------------- | ------------ | ------------- | +| /v1/metadata-schemas | get | List Metadata Schemas | | | +| /v1/metadata-schemas/{resource} | get | Get Metadata Schema | | | +## Locations +| endpoint | method | summary | is supported | is deprecated | +| -------------------------- | ------ | -------------- | ------------ | ------------- | +| /v1/locations | get | List Locations | | | +| /v1/locations/{locationId} | get | Get Location | | | +## Referrals +| endpoint | method | summary | is supported | is deprecated | +| ---------------------------------------------------------------- | ------ | --------------------------- | ------------ | ------------- | +| /v1/referrals/{campaignId}/members/{memberId}/holders | post | Add Referral Code Holders | | | +| /v1/referrals/{campaignId}/members/{memberId}/holders | get | List Referral Code Holders | | | +| /v1/referrals/{campaignId}/members/{memberId}/holders/{holderId} | delete | Remove Referral Card Holder | | | +| /v1/referrals/members/{memberId}/holders | post | Add Referral Code Holders | | | +| /v1/referrals/members/{memberId}/holders | get | List Referral Code Holders | | | +| /v1/referrals/members/{memberId}/holders/{holderId} | delete | Remove Referral Card Holder | | | +## Bin +| endpoint | method | summary | is supported | is deprecated | +| -------------------------- | ------ | ---------------- | ------------ | ------------- | +| /v1/trash-bin | get | List Bin Entries | | | +| /v1/trash-bin/{binEntryId} | delete | Delete Bin Entry | | | +## Templates +| endpoint | method | summary | is supported | is deprecated | +| ----------------------- | ------ | ------------------------ | ------------ | ------------- | +| /v1/templates/campaigns | get | List Campaign Templates | | | +| /v1/templates/campaigns | post | Create Campaign Template | | | +## Management +| endpoint | method | summary | is supported | is deprecated | +| ------------------------------------------------------------------------------ | ------ | -------------------------- | ------------ | ------------- | +| /management/v1/projects | post | Create Project | | | +| /management/v1/projects | get | List Projects | | | +| /management/v1/projects/{projectId} | get | Get Project | | | +| /management/v1/projects/{projectId} | put | Update Project | | | +| /management/v1/projects/{projectId} | delete | Delete Project | | | +| /management/v1/projects/{projectId}/users | post | Assign User | | | +| /management/v1/projects/{projectId}/users | get | List Users | | | +| /management/v1/projects/{projectId}/users/{userId} | get | Get User | | | +| /management/v1/projects/{projectId}/users/{userId} | put | Update User | | | +| /management/v1/projects/{projectId}/users/{userId} | delete | Unassign User | | | +| /management/v1/projects/users/invite | post | Invite a New User | | | +| /management/v1/projects/{projectId}/stacking-rules | post | Create Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules | get | List Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | get | Get Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | put | Update Stacking Rules | | | +| /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} | delete | Delete Stacking Rules | | | +| /management/v1/projects/{projectId}/metadata-schemas | post | Create Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas | get | List Metadata Schemas | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | get | Get Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | put | Update Metadata Schema | | | +| /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} | delete | Delete Metadata Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas | post | Create Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas | get | List Custom Event Schemas | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | get | Get Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | put | Update Custom Event Schema | | | +| /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} | delete | Delete Custom Event Schema | | | +| /management/v1/projects/{projectId}/webhooks | post | Create Webhook | | | +| /management/v1/projects/{projectId}/webhooks | get | List Webhooks | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | get | Get Webhook | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | put | Update Webhook | | | +| /management/v1/projects/{projectId}/webhooks/{webhookId} | delete | Delete Webhook | | | +| /management/v1/projects/{projectId}/branding | post | Create Brand | | | +| /management/v1/projects/{projectId}/branding | get | List Brands | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | get | Get Brand | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | put | Update Brand | | | +| /management/v1/projects/{projectId}/branding/{brandingId} | delete | Delete Brand | | | +## Client-side +| endpoint | method | summary | is supported | is deprecated | +| --------------------------- | ------ | ------------------------------------------- | ------------------------------------ | ------------------------------------ | +| /client/v1/qualifications | post | Check Eligibility (client-side) | supported | | +| /client/v1/promotions/tiers | get | List Promotion Tiers (client-side) | supported | | +| /client/v1/redemptions | post | Redeem Stackable Discounts (client-side) | supported | | +| /client/v1/validations | post | Validate Stackable Discounts (client-side) | supported | | +| /client/v1/events | post | Track Custom Event (client-side) | supported | | +| /client/v1/validate | get | Validate Voucher (client-side) [Deprecated] | | deprecated | +| /client/v1/redeem | post | Redeem Voucher (client-side) [Deprecated] | | deprecated | +| /client/v1/publish | post | Create Publication (client-side) | | | \ No newline at end of file diff --git a/README.md b/README.md index 2fff00e0..67fcf12c 100644 --- a/README.md +++ b/README.md @@ -1,279 +1,1304 @@ -

- -

+![Voucherify Python SDK](././voucherify-python-sdk.png) -

Official Voucherify SDK for Python

+## Official [Voucherify](https://www.voucherify.io/) SDK for Python -

-Setup -| -Contributing -| -Changelog -

+Voucherify empowers marketers and developers with flexible building blocks to come up with, implement, and track targeted promotional campaigns. -

-API: -Vouchers -| -Distributions -| -Redemptions -| -Customers -| -Utils -

+Learn more about Voucherify by visiting [our site](https://www.voucherify.io). +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) based on our [Documentation](https://docs.voucherify.io/docs/introduction) with v2018-08-01 version. ---- +The legacy version of Python SDK could be found [here](https://github.com/voucherifyio/voucherify-python-sdk/releases/tag/v2.2.2) -## Setup +## ๐Ÿ“ Documentation -`pip install 'Voucherify'` +You will find detailed description and example responses at our [official documentation](https://docs.voucherify.io/reference). Most method headers point to more detailed descriptions of arguments you can use. -[Log-in](https://app.voucherify.io/?utm_source=github&utm_medium=sdk&utm_campaign=acq#/login) to Voucherify web interface and obtain your Application Keys from [Configuration](https://app.voucherify.io/?utm_source=github&utm_medium=sdk&utm_campaign=acq#/app/configuration): +๐Ÿ“š Want to learn more? Visit our [official site](https://www.voucherify.io) or our [Success Portal](https://success.voucherify.io). -```python -from voucherify import Client as voucherifyClient +๐Ÿ‘ฝ Having troubles? Check our [Help center](https://support.voucherify.io/). -client = voucherifyClient( - application_id='YOUR-APPLICATION-ID', - client_secret_key='YOUR-CLIENT-SECRET-KEY' -) -``` +๐Ÿงช Looking for promotion ideas? Check our [Cookbook](https://cookbook.voucherify.io/) to get an inspiration. -### API Endpoint +๐Ÿ› Encounter a bug? Please file a report in the [Issues](https://github.com/voucherifyio/voucherify-python-sdk/issues). -Optionally, you can add `api_endpoint` to the client options if you want to use Voucherify running in a specific region. -Optionally, you can add `timeout` to specify request's timeout in seconds. Default value is set to 3 minutes. +โœ… Supported endpoint can be found [here](./ENDPOINTS-COVERAGE.md) -```python -from voucherify import Client as voucherifyClient +## Requirements. -client = voucherifyClient( - application_id='YOUR-APPLICATION-ID', - client_secret_key='YOUR-CLIENT-SECRET-KEY', - api_endpoint='https://.api.voucherify.io', - timeout=180 -) -``` +Python 3.7+ -## API +## Installation -This SDK is consistent with restful API Voucherify provides. -Not all API methods are currently supported in this SDK, but they are coming soon. +To install the API client library to your local Maven repository, simply execute: -You will find detailed description and example responses at [official docs](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq). -Method headers point to more detailed descriptions of params you can use. +```sh +pip install 'Voucherify' +``` -### Vouchers API -Methods are provided within `client.vouchers.*` namespace. -- [Create Voucher](#create-voucher) -- [Get Voucher](#get-voucher) -- [Update Voucher](#update-voucher) -- [List Vouchers](#list-vouchers) -- [Enable Voucher](#enable-voucher) -- [Disable Voucher](#disable-voucher) -- [Release Validation Session](#release-validation-session) +Then import the package: -#### [Create Voucher] ```python -client.vouchers.create(voucher) +import voucherify ``` -Check [voucher object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-voucher-object). -#### [Get Voucher] -```python -client.vouchers.get(code) -``` -#### [Update Voucher] -```python -client.vouchers.update(voucher) -``` -#### [List Vouchers] -```python -client.vouchers.list(params) -``` -#### [Enable Voucher] -```python -client.vouchers.enable(code) -``` -#### [Disable Voucher] -```python -client.vouchers.disable(code) -``` -#### [Release Validation Session] +## ๐Ÿš€ Running code + +Please follow the [installation](#installation) instruction and execute the following Python code: + ```python -client.vouchers.releaseValidationSession(code, sessionKey) -``` +import os +import voucherify +from dotenv import load_dotenv ---- +load_dotenv() -### Distributions API -Methods are provided within `client.distributions.*` namespace. +HOST = os.getenv('VOUCHERIFY_HOST', 'https://api.voucherify.io') +X_APP_ID = os.getenv('X_APP_ID') +X_APP_TOKEN = os.getenv('X_APP_TOKEN') -- [Publish Voucher](#publish-voucher) +if not X_APP_ID or not X_APP_TOKEN: + raise ValueError("X_APP_ID and X_APP_TOKEN must be set in the .env file.") -#### [Publish Voucher] -```python -client.distributions.publish(params) -``` +configuration = voucherify.Configuration( + host=HOST, + api_key={ + "X-App-Id": X_APP_ID, + "X-App-Token": X_APP_TOKEN + } +) +# Debugging line +api_key_id = configuration.get_api_key_with_prefix('X-App-Id') +api_key_token = configuration.get_api_key_with_prefix('X-App-Token') ---- -### Validations API -Methods are provided within `client.validations.*` namespace. +# Print whether both API keys are present and valid +are_keys_present = bool(api_key_id) and bool(api_key_token) +print(f"Configuration loaded: {are_keys_present}") -- [Validate Voucher](#validate-voucher) -- [Validate Stackable](#validate-stackable) +if(are_keys_present): + with voucherify.ApiClient(configuration) as api_client: + customers_api_instance = voucherify.CustomersApi(api_client) -#### [Validate Voucher] -```python -client.validations.validateVoucher(code, params) -``` -#### [Validate Stackable] -```python -client.validations.validateStackable(params) + try: + result = customers_api_instance.list_customers() + print(result) + + except voucherifyClient.ApiException as e: + self.fail(e) ``` ---- +It may be useful to check the tests implementation in the folder **tests** `(./__tests__)` -### Redemptions API -Methods are provided within `client.redemptions.*` namespace. +## ๐Ÿณ Running local tests with docker -- [Redeem Voucher](#redeem-voucher) -- [Redeem Stackable](#redeem-stackable) -- [List Redemptions](#list-redemptions) -- [Get Voucher's Redemptions](#get-vouchers-redemptions) -- [Rollback Redemption](#rollback-redemption) +1. Copy `.env.example` to `.env` and fill in the values. +2. Run `docker build -t python .` to build the image. +3. Run `docker run --rm python` to run the tests and delete container immediately after. -#### [Redeem Voucher] -```python -client.redemptions.redeem(code, tracking_id) -``` -#### [Redeem Stackable] -```python -client.redemptions.redeemStackable(params) -``` -#### [List Redemptions] -```python -client.redemptions.list(params) -``` -#### [Get Voucher's Redemptions] -```python -client.redemptions.getForVoucher(code) -``` -#### [Rollback Redemption] -```python -client.redemptions.rollback(redemptionId) -client.redemptions.rollback(redemptionId, reason) -``` -Check [redemption rollback object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-redemption-rollback-object). +## ๐Ÿ› ๏ธ Contributing ---- +Read more about how to Contribute to Voucherify Python SDK by visiting main repo [GENERATING-SDKS.md](https://github.com/voucherifyio/voucherify-openapi/blob/master/GENERATING-SDKS.md) -### Customers API -Methods are provided within `client.customers.*` namespace. +Remember that this SDK is auto generated (except of the tests) so changes made here will be overwritten by generator. -- [Create Customer](#create-customer) -- [Get Customer](#get-customer) -- [Update Customer](#update-customer) -- [Delete Customer](#delete-customer) +## ๐Ÿ“… Changelog -#### [Create Customer] -```python -client.customers.create(customer) -``` -Check [customer object](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-customer-object). -#### [Get Customer] -```python -client.customers.get(customerId) -``` -#### [Update Customer] -`customer` object must contain `id` or `source_id`. +- **2024-09-18** - `3.0.0` + - The new version of the SDK includes coverage for all the most commonly used Voucherify endpoints and supports typed models. + +*Previous versions of the API are no longer supported, and we highly recommend upgrading to version 3.0.0, which is now designated as Long-Term Support (LTS).* + +*Changelog for previous versions could be found in [here](./DEPRECATED_CHANGELOG.md)* + +## ๐Ÿ” Documentation for Authorization ```python -client.customers.update(customer) +import os +import voucherify +from dotenv import load_dotenv + +load_dotenv() + +HOST = os.getenv('VOUCHERIFY_HOST', 'https://api.voucherify.io') +X_APP_ID = os.getenv('X_APP_ID') +X_APP_TOKEN = os.getenv('X_APP_TOKEN') + +if not X_APP_ID or not X_APP_TOKEN: + raise ValueError("X_APP_ID and X_APP_TOKEN must be set in the .env file.") + +configuration = voucherify.Configuration( + host=HOST, + api_key={ + "X-App-Id": X_APP_ID, + "X-App-Token": X_APP_TOKEN + } +) +# Debugging line +api_key_id = configuration.get_api_key_with_prefix('X-App-Id') +api_key_token = configuration.get_api_key_with_prefix('X-App-Token') + +# Print whether both API keys are present and valid +are_keys_present = bool(api_key_id) and bool(api_key_token) +print(f"Configuration loaded: {are_keys_present}") ``` -#### [Delete Customer] + +then use + ```python -client.customers.delete(customerId) +import voucherify + +(...) + with voucherify.ApiClient(configuration) as api_client: ``` ---- +## Documentation for API Endpoints -### Utils +All URIs are relative to *https://api.voucherify.io* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AsyncActionsApi* | [**get_async_action**](docs/AsyncActionsApi.md#get_async_action) | **GET** /v1/async-actions/{asyncActionId} | Get Async Action +*AsyncActionsApi* | [**list_async_actions**](docs/AsyncActionsApi.md#list_async_actions) | **GET** /v1/async-actions | List Async Actions +*CampaignsApi* | [**add_voucher_with_specific_code_to_campaign**](docs/CampaignsApi.md#add_voucher_with_specific_code_to_campaign) | **POST** /v1/campaigns/{campaignId}/vouchers/{code} | Add Voucher with Specific Code to Campaign +*CampaignsApi* | [**add_vouchers_to_campaign**](docs/CampaignsApi.md#add_vouchers_to_campaign) | **POST** /v1/campaigns/{campaignId}/vouchers | Add Vouchers to Campaign +*CampaignsApi* | [**create_campaign**](docs/CampaignsApi.md#create_campaign) | **POST** /v1/campaigns | Create Campaign +*CampaignsApi* | [**delete_campaign**](docs/CampaignsApi.md#delete_campaign) | **DELETE** /v1/campaigns/{campaignId} | Delete Campaign +*CampaignsApi* | [**disable_campaign**](docs/CampaignsApi.md#disable_campaign) | **POST** /v1/campaigns/{campaignId}/disable | Disable Campaign +*CampaignsApi* | [**enable_campaign**](docs/CampaignsApi.md#enable_campaign) | **POST** /v1/campaigns/{campaignId}/enable | Enable Campaign +*CampaignsApi* | [**get_campaign**](docs/CampaignsApi.md#get_campaign) | **GET** /v1/campaigns/{campaignId} | Get Campaign +*CampaignsApi* | [**import_vouchers_to_campaign**](docs/CampaignsApi.md#import_vouchers_to_campaign) | **POST** /v1/campaigns/{campaignId}/import | Import Vouchers to Campaign +*CampaignsApi* | [**import_vouchers_to_campaign_using_csv**](docs/CampaignsApi.md#import_vouchers_to_campaign_using_csv) | **POST** /v1/campaigns/{campaignId}/importCSV | Import Vouchers to Campaign by CSV +*CampaignsApi* | [**list_campaigns**](docs/CampaignsApi.md#list_campaigns) | **GET** /v1/campaigns | List Campaigns +*CampaignsApi* | [**update_campaign**](docs/CampaignsApi.md#update_campaign) | **PUT** /v1/campaigns/{campaignId} | Update Campaign +*CategoriesApi* | [**create_category**](docs/CategoriesApi.md#create_category) | **POST** /v1/categories | Create Category +*CategoriesApi* | [**delete_category**](docs/CategoriesApi.md#delete_category) | **DELETE** /v1/categories/{categoryId} | Delete Category +*CategoriesApi* | [**get_category**](docs/CategoriesApi.md#get_category) | **GET** /v1/categories/{categoryId} | Get Category +*CategoriesApi* | [**list_categories**](docs/CategoriesApi.md#list_categories) | **GET** /v1/categories | List Categories +*CategoriesApi* | [**update_category**](docs/CategoriesApi.md#update_category) | **PUT** /v1/categories/{categoryId} | Update Category +*ClientSideApi* | [**check_eligibility_client_side**](docs/ClientSideApi.md#check_eligibility_client_side) | **POST** /client/v1/qualifications | Check Eligibility (client-side) +*ClientSideApi* | [**list_promotion_tiers_client_side**](docs/ClientSideApi.md#list_promotion_tiers_client_side) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (client-side) +*ClientSideApi* | [**redeem_stacked_discounts_client_side**](docs/ClientSideApi.md#redeem_stacked_discounts_client_side) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) +*ClientSideApi* | [**track_custom_event_client_side**](docs/ClientSideApi.md#track_custom_event_client_side) | **POST** /client/v1/events | Track Custom Event (client-side) +*ClientSideApi* | [**validate_stacked_discounts_client_side**](docs/ClientSideApi.md#validate_stacked_discounts_client_side) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) +*CustomersApi* | [**create_customer**](docs/CustomersApi.md#create_customer) | **POST** /v1/customers | Create Customer +*CustomersApi* | [**customer_permanently_deletion**](docs/CustomersApi.md#customer_permanently_deletion) | **POST** /v1/customers/{customerId}/permanent-deletion | Delete Customer Permanently +*CustomersApi* | [**delete_customer**](docs/CustomersApi.md#delete_customer) | **DELETE** /v1/customers/{customerId} | Delete Customer +*CustomersApi* | [**get_customer**](docs/CustomersApi.md#get_customer) | **GET** /v1/customers/{customerId} | Get Customer +*CustomersApi* | [**import_customers_using_csv**](docs/CustomersApi.md#import_customers_using_csv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV +*CustomersApi* | [**list_customer_activity**](docs/CustomersApi.md#list_customer_activity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity +*CustomersApi* | [**list_customer_redeemables**](docs/CustomersApi.md#list_customer_redeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables +*CustomersApi* | [**list_customer_segments**](docs/CustomersApi.md#list_customer_segments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments +*CustomersApi* | [**list_customers**](docs/CustomersApi.md#list_customers) | **GET** /v1/customers | List Customers +*CustomersApi* | [**update_customer**](docs/CustomersApi.md#update_customer) | **PUT** /v1/customers/{customerId} | Update Customer +*CustomersApi* | [**update_customers_in_bulk**](docs/CustomersApi.md#update_customers_in_bulk) | **POST** /v1/customers/bulk/async | Update Customers in Bulk +*CustomersApi* | [**update_customers_metadata_in_bulk**](docs/CustomersApi.md#update_customers_metadata_in_bulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in Bulk +*EventsApi* | [**track_custom_event**](docs/EventsApi.md#track_custom_event) | **POST** /v1/events | Track Custom Event +*ExportsApi* | [**create_export**](docs/ExportsApi.md#create_export) | **POST** /v1/exports | Create Export +*ExportsApi* | [**delete_export**](docs/ExportsApi.md#delete_export) | **DELETE** /v1/exports/{exportId} | Delete Export +*ExportsApi* | [**download_export**](docs/ExportsApi.md#download_export) | **GET** /v1/exports/{export_Id} | Download Export +*ExportsApi* | [**get_export**](docs/ExportsApi.md#get_export) | **GET** /v1/exports/{exportId} | Get Export +*ExportsApi* | [**list_exports**](docs/ExportsApi.md#list_exports) | **GET** /v1/exports | List Exports +*LoyaltiesApi* | [**add_member**](docs/LoyaltiesApi.md#add_member) | **POST** /v1/loyalties/{campaignId}/members | Add Member +*LoyaltiesApi* | [**create_earning_rule**](docs/LoyaltiesApi.md#create_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules | Create Earning Rule +*LoyaltiesApi* | [**create_in_bulk_loyalty_tiers**](docs/LoyaltiesApi.md#create_in_bulk_loyalty_tiers) | **POST** /v1/loyalties/{campaignId}/tiers | Create loyalty tiers +*LoyaltiesApi* | [**create_loyalty_program**](docs/LoyaltiesApi.md#create_loyalty_program) | **POST** /v1/loyalties | Create Loyalty Campaign +*LoyaltiesApi* | [**create_points_expiration_export**](docs/LoyaltiesApi.md#create_points_expiration_export) | **POST** /v1/loyalties/{campaignId}/points-expiration/export | Create Points Expiration Export +*LoyaltiesApi* | [**create_reward_assignment1**](docs/LoyaltiesApi.md#create_reward_assignment1) | **POST** /v1/loyalties/{campaignId}/rewards | Create Reward Assignment +*LoyaltiesApi* | [**delete_earning_rule**](docs/LoyaltiesApi.md#delete_earning_rule) | **DELETE** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Delete Earning Rule +*LoyaltiesApi* | [**delete_loyalty_program**](docs/LoyaltiesApi.md#delete_loyalty_program) | **DELETE** /v1/loyalties/{campaignId} | Delete Loyalty Campaign +*LoyaltiesApi* | [**delete_reward_assignment1**](docs/LoyaltiesApi.md#delete_reward_assignment1) | **DELETE** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Delete Reward Assignment +*LoyaltiesApi* | [**disable_earning_rule**](docs/LoyaltiesApi.md#disable_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable | Disable Earning Rule +*LoyaltiesApi* | [**enable_earning_rule**](docs/LoyaltiesApi.md#enable_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable | Enable Earning Rule +*LoyaltiesApi* | [**export_loyalty_card_transactions**](docs/LoyaltiesApi.md#export_loyalty_card_transactions) | **POST** /v1/loyalties/members/{memberId}/transactions/export | Export Loyalty Card Transactions +*LoyaltiesApi* | [**export_loyalty_card_transactions1**](docs/LoyaltiesApi.md#export_loyalty_card_transactions1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | Export Loyalty Card Transactions +*LoyaltiesApi* | [**get_earning_rule**](docs/LoyaltiesApi.md#get_earning_rule) | **GET** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Get Earning Rule +*LoyaltiesApi* | [**get_loyalty_program**](docs/LoyaltiesApi.md#get_loyalty_program) | **GET** /v1/loyalties/{campaignId} | Get Loyalty Campaign +*LoyaltiesApi* | [**get_loyalty_tier**](docs/LoyaltiesApi.md#get_loyalty_tier) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | Get Loyalty Tier +*LoyaltiesApi* | [**get_member**](docs/LoyaltiesApi.md#get_member) | **GET** /v1/loyalties/members/{memberId} | Get Member +*LoyaltiesApi* | [**get_member1**](docs/LoyaltiesApi.md#get_member1) | **GET** /v1/loyalties/{campaignId}/members/{memberId} | Get Member +*LoyaltiesApi* | [**get_reward_assignment1**](docs/LoyaltiesApi.md#get_reward_assignment1) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | Get Reward Assignment +*LoyaltiesApi* | [**get_reward_assignment2**](docs/LoyaltiesApi.md#get_reward_assignment2) | **GET** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Get Reward Assignment +*LoyaltiesApi* | [**get_reward_details**](docs/LoyaltiesApi.md#get_reward_details) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | Get Reward Details +*LoyaltiesApi* | [**list_earning_rules**](docs/LoyaltiesApi.md#list_earning_rules) | **GET** /v1/loyalties/{campaignId}/earning-rules | List Earning Rules +*LoyaltiesApi* | [**list_loyalty_card_transactions**](docs/LoyaltiesApi.md#list_loyalty_card_transactions) | **GET** /v1/loyalties/members/{memberId}/transactions | List Loyalty Card Transactions +*LoyaltiesApi* | [**list_loyalty_card_transactions1**](docs/LoyaltiesApi.md#list_loyalty_card_transactions1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/transactions | List Loyalty Card Transactions +*LoyaltiesApi* | [**list_loyalty_programs**](docs/LoyaltiesApi.md#list_loyalty_programs) | **GET** /v1/loyalties | List Loyalty Campaigns +*LoyaltiesApi* | [**list_loyalty_tier_earning_rules**](docs/LoyaltiesApi.md#list_loyalty_tier_earning_rules) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | List Loyalty Tier Earning Rules +*LoyaltiesApi* | [**list_loyalty_tier_rewards**](docs/LoyaltiesApi.md#list_loyalty_tier_rewards) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | List Loyalty Tier Rewards +*LoyaltiesApi* | [**list_loyalty_tiers**](docs/LoyaltiesApi.md#list_loyalty_tiers) | **GET** /v1/loyalties/{campaignId}/tiers | List Loyalty Tiers +*LoyaltiesApi* | [**list_member_activity**](docs/LoyaltiesApi.md#list_member_activity) | **GET** /v1/loyalties/members/{memberId}/activity | List Member Activity +*LoyaltiesApi* | [**list_member_activity1**](docs/LoyaltiesApi.md#list_member_activity1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/activity | List Member Activity +*LoyaltiesApi* | [**list_member_loyalty_tier**](docs/LoyaltiesApi.md#list_member_loyalty_tier) | **GET** /v1/loyalties/members/{memberId}/tiers | List Member's Loyalty Tiers +*LoyaltiesApi* | [**list_member_rewards**](docs/LoyaltiesApi.md#list_member_rewards) | **GET** /v1/loyalties/members/{memberId}/rewards | List Member Rewards +*LoyaltiesApi* | [**list_members**](docs/LoyaltiesApi.md#list_members) | **GET** /v1/loyalties/{campaignId}/members | List Members +*LoyaltiesApi* | [**list_points_expiration**](docs/LoyaltiesApi.md#list_points_expiration) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | Get Points Expiration +*LoyaltiesApi* | [**list_reward_assignments1**](docs/LoyaltiesApi.md#list_reward_assignments1) | **GET** /v1/loyalties/{campaignId}/reward-assignments | List Reward Assignments +*LoyaltiesApi* | [**list_reward_assignments2**](docs/LoyaltiesApi.md#list_reward_assignments2) | **GET** /v1/loyalties/{campaignId}/rewards | List Reward Assignments +*LoyaltiesApi* | [**redeem_reward**](docs/LoyaltiesApi.md#redeem_reward) | **POST** /v1/loyalties/members/{memberId}/redemption | Redeem Reward +*LoyaltiesApi* | [**redeem_reward1**](docs/LoyaltiesApi.md#redeem_reward1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/redemption | Redeem Reward +*LoyaltiesApi* | [**transfer_points**](docs/LoyaltiesApi.md#transfer_points) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transfers | Transfer Loyalty Points +*LoyaltiesApi* | [**update_earning_rule**](docs/LoyaltiesApi.md#update_earning_rule) | **PUT** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Update Earning Rule +*LoyaltiesApi* | [**update_loyalty_card_balance**](docs/LoyaltiesApi.md#update_loyalty_card_balance) | **POST** /v1/loyalties/members/{memberId}/balance | Add or Remove Loyalty Card Balance +*LoyaltiesApi* | [**update_loyalty_card_balance1**](docs/LoyaltiesApi.md#update_loyalty_card_balance1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/balance | Add or Remove Loyalty Card Balance +*LoyaltiesApi* | [**update_loyalty_program**](docs/LoyaltiesApi.md#update_loyalty_program) | **PUT** /v1/loyalties/{campaignId} | Update Loyalty Campaign +*LoyaltiesApi* | [**update_reward_assignment1**](docs/LoyaltiesApi.md#update_reward_assignment1) | **PUT** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Update Reward Assignment +*OrdersApi* | [**create_order**](docs/OrdersApi.md#create_order) | **POST** /v1/orders | Create Order +*OrdersApi* | [**create_order_export**](docs/OrdersApi.md#create_order_export) | **POST** /v1/orders/export | Create Orders Export +*OrdersApi* | [**get_order**](docs/OrdersApi.md#get_order) | **GET** /v1/orders/{orderId} | Get Order +*OrdersApi* | [**import_orders**](docs/OrdersApi.md#import_orders) | **POST** /v1/orders/import | Import Orders +*OrdersApi* | [**list_orders**](docs/OrdersApi.md#list_orders) | **GET** /v1/orders | List Orders +*OrdersApi* | [**update_order**](docs/OrdersApi.md#update_order) | **PUT** /v1/orders/{orderId} | Update Order +*ProductCollectionsApi* | [**create_product_collection**](docs/ProductCollectionsApi.md#create_product_collection) | **POST** /v1/product-collections | Create Product Collection +*ProductCollectionsApi* | [**delete_product_collection**](docs/ProductCollectionsApi.md#delete_product_collection) | **DELETE** /v1/product-collections/{productCollectionId} | Delete Product Collection +*ProductCollectionsApi* | [**get_product_collection**](docs/ProductCollectionsApi.md#get_product_collection) | **GET** /v1/product-collections/{productCollectionId} | Get Product Collection +*ProductCollectionsApi* | [**list_product_collections**](docs/ProductCollectionsApi.md#list_product_collections) | **GET** /v1/product-collections | List Product Collections +*ProductCollectionsApi* | [**list_products_in_collection**](docs/ProductCollectionsApi.md#list_products_in_collection) | **GET** /v1/product-collections/{productCollectionId}/products | List Products in Collection +*ProductsApi* | [**create_product**](docs/ProductsApi.md#create_product) | **POST** /v1/products | Create Product +*ProductsApi* | [**create_sku**](docs/ProductsApi.md#create_sku) | **POST** /v1/products/{productId}/skus | Create SKU +*ProductsApi* | [**delete_product**](docs/ProductsApi.md#delete_product) | **DELETE** /v1/products/{productId} | Delete Product +*ProductsApi* | [**delete_sku**](docs/ProductsApi.md#delete_sku) | **DELETE** /v1/products/{productId}/skus/{skuId} | Delete SKU +*ProductsApi* | [**get_product**](docs/ProductsApi.md#get_product) | **GET** /v1/products/{productId} | Get Product +*ProductsApi* | [**get_sku**](docs/ProductsApi.md#get_sku) | **GET** /v1/skus/{skuId} | Get SKU +*ProductsApi* | [**import_products_using_csv**](docs/ProductsApi.md#import_products_using_csv) | **POST** /v1/products/importCSV | Import Products using CSV +*ProductsApi* | [**import_skus_using_csv**](docs/ProductsApi.md#import_skus_using_csv) | **POST** /v1/skus/importCSV | Import SKUs using CSV +*ProductsApi* | [**list_products**](docs/ProductsApi.md#list_products) | **GET** /v1/products | List Products +*ProductsApi* | [**list_skus_in_product**](docs/ProductsApi.md#list_skus_in_product) | **GET** /v1/products/{productId}/skus | List SKUs in Product +*ProductsApi* | [**update_product**](docs/ProductsApi.md#update_product) | **PUT** /v1/products/{productId} | Update Product +*ProductsApi* | [**update_products_in_bulk**](docs/ProductsApi.md#update_products_in_bulk) | **POST** /v1/products/bulk/async | Update Products in Bulk +*ProductsApi* | [**update_products_metadata_in_bulk**](docs/ProductsApi.md#update_products_metadata_in_bulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in Bulk +*ProductsApi* | [**update_sku**](docs/ProductsApi.md#update_sku) | **PUT** /v1/products/{productId}/skus/{skuId} | Update SKU +*PromotionsApi* | [**add_promotion_tier_to_campaign**](docs/PromotionsApi.md#add_promotion_tier_to_campaign) | **POST** /v1/promotions/{campaignId}/tiers | Add Promotion Tier to Campaign +*PromotionsApi* | [**create_promotion_stack**](docs/PromotionsApi.md#create_promotion_stack) | **POST** /v1/promotions/{campaignId}/stacks | Create Promotion Stack +*PromotionsApi* | [**delete_promotion_stack**](docs/PromotionsApi.md#delete_promotion_stack) | **DELETE** /v1/promotions/{campaignId}/stacks/{stackId} | Delete Promotion Stack +*PromotionsApi* | [**delete_promotion_tier**](docs/PromotionsApi.md#delete_promotion_tier) | **DELETE** /v1/promotions/tiers/{promotionTierId} | Delete Promotion Tier +*PromotionsApi* | [**disable_promotion_tier**](docs/PromotionsApi.md#disable_promotion_tier) | **POST** /v1/promotions/tiers/{promotionTierId}/disable | Disable Promotion Tier +*PromotionsApi* | [**enable_promotion_tier**](docs/PromotionsApi.md#enable_promotion_tier) | **POST** /v1/promotions/tiers/{promotionTierId}/enable | Enable Promotion Tier +*PromotionsApi* | [**get_promotion_stack**](docs/PromotionsApi.md#get_promotion_stack) | **GET** /v1/promotions/{campaignId}/stacks/{stackId} | Get Promotion Stack +*PromotionsApi* | [**get_promotion_tier**](docs/PromotionsApi.md#get_promotion_tier) | **GET** /v1/promotions/tiers/{promotionTierId} | Get Promotion Tier +*PromotionsApi* | [**list_all_promotion_stacks**](docs/PromotionsApi.md#list_all_promotion_stacks) | **GET** /v1/promotions/stacks | List Promotion Stacks +*PromotionsApi* | [**list_promotion_stacks_in_campaign**](docs/PromotionsApi.md#list_promotion_stacks_in_campaign) | **GET** /v1/promotions/{campaignId}/stacks | List Promotion Stacks in Campaign +*PromotionsApi* | [**list_promotion_tiers**](docs/PromotionsApi.md#list_promotion_tiers) | **GET** /v1/promotions/tiers | List Promotion Tiers +*PromotionsApi* | [**list_promotion_tiers_from_campaign**](docs/PromotionsApi.md#list_promotion_tiers_from_campaign) | **GET** /v1/promotions/{campaignId}/tiers | List Promotion Tiers from Campaign +*PromotionsApi* | [**update_promotion_stack**](docs/PromotionsApi.md#update_promotion_stack) | **PUT** /v1/promotions/{campaignId}/stacks/{stackId} | Update Promotion Stack +*PromotionsApi* | [**update_promotion_tier**](docs/PromotionsApi.md#update_promotion_tier) | **PUT** /v1/promotions/tiers/{promotionTierId} | Update Promotion Tier +*PublicationsApi* | [**create_publication**](docs/PublicationsApi.md#create_publication) | **POST** /v1/publications | Create Publication +*PublicationsApi* | [**create_publication1**](docs/PublicationsApi.md#create_publication1) | **GET** /v1/publications/create | Create Publication +*PublicationsApi* | [**list_publications**](docs/PublicationsApi.md#list_publications) | **GET** /v1/publications | List Publications +*QualificationsApi* | [**check_eligibility**](docs/QualificationsApi.md#check_eligibility) | **POST** /v1/qualifications | Check Eligibility +*RedemptionsApi* | [**get_redemption**](docs/RedemptionsApi.md#get_redemption) | **GET** /v1/redemptions/{redemptionId} | Get Redemption +*RedemptionsApi* | [**get_voucher_redemptions**](docs/RedemptionsApi.md#get_voucher_redemptions) | **GET** /v1/vouchers/{code}/redemption | Get Voucher's Redemptions +*RedemptionsApi* | [**list_redemptions**](docs/RedemptionsApi.md#list_redemptions) | **GET** /v1/redemptions | List Redemptions +*RedemptionsApi* | [**redeem_stacked_discounts**](docs/RedemptionsApi.md#redeem_stacked_discounts) | **POST** /v1/redemptions | Redeem Stackable Discounts +*RedemptionsApi* | [**rollback_redemption**](docs/RedemptionsApi.md#rollback_redemption) | **POST** /v1/redemptions/{redemptionId}/rollback | Rollback Redemption +*RedemptionsApi* | [**rollback_stacked_redemptions**](docs/RedemptionsApi.md#rollback_stacked_redemptions) | **POST** /v1/redemptions/{parentRedemptionId}/rollbacks | Rollback Stackable Redemptions +*RewardsApi* | [**create_reward**](docs/RewardsApi.md#create_reward) | **POST** /v1/rewards | Create Reward +*RewardsApi* | [**create_reward_assignment**](docs/RewardsApi.md#create_reward_assignment) | **POST** /v1/rewards/{rewardId}/assignments | Create Reward Assignment +*RewardsApi* | [**delete_reward**](docs/RewardsApi.md#delete_reward) | **DELETE** /v1/rewards/{rewardId} | Delete Reward +*RewardsApi* | [**delete_reward_assignment**](docs/RewardsApi.md#delete_reward_assignment) | **DELETE** /v1/rewards/{rewardId}/assignments/{assignmentId} | Delete Reward Assignment +*RewardsApi* | [**get_reward**](docs/RewardsApi.md#get_reward) | **GET** /v1/rewards/{rewardId} | Get Reward +*RewardsApi* | [**get_reward_assignment**](docs/RewardsApi.md#get_reward_assignment) | **GET** /v1/rewards/{rewardId}/assignments/{assignmentId} | Get Reward Assignment +*RewardsApi* | [**list_reward_assignments**](docs/RewardsApi.md#list_reward_assignments) | **GET** /v1/rewards/{rewardId}/assignments | List Reward Assignments +*RewardsApi* | [**list_rewards**](docs/RewardsApi.md#list_rewards) | **GET** /v1/rewards | List Rewards +*RewardsApi* | [**update_reward**](docs/RewardsApi.md#update_reward) | **PUT** /v1/rewards/{rewardId} | Update Reward +*RewardsApi* | [**update_reward_assignment**](docs/RewardsApi.md#update_reward_assignment) | **PUT** /v1/rewards/{rewardId}/assignments/{assignmentId} | Update Reward Assignment +*SegmentsApi* | [**create_segment**](docs/SegmentsApi.md#create_segment) | **POST** /v1/segments | Create Segment +*SegmentsApi* | [**delete_segment**](docs/SegmentsApi.md#delete_segment) | **DELETE** /v1/segments/{segmentId} | Delete Segment +*SegmentsApi* | [**get_segment**](docs/SegmentsApi.md#get_segment) | **GET** /v1/segments/{segmentId} | Get Segment +*ValidationRulesApi* | [**create_validation_rule_assignment**](docs/ValidationRulesApi.md#create_validation_rule_assignment) | **POST** /v1/validation-rules/{validationRuleId}/assignments | Create Validation Rules Assignments +*ValidationRulesApi* | [**create_validation_rules**](docs/ValidationRulesApi.md#create_validation_rules) | **POST** /v1/validation-rules | Create Validation Rules +*ValidationRulesApi* | [**delete_validation_rule_assignment**](docs/ValidationRulesApi.md#delete_validation_rule_assignment) | **DELETE** /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | Delete Validation Rule Assignment +*ValidationRulesApi* | [**delete_validation_rules**](docs/ValidationRulesApi.md#delete_validation_rules) | **DELETE** /v1/validation-rules/{validationRuleId} | Delete Validation Rule +*ValidationRulesApi* | [**get_validation_rule**](docs/ValidationRulesApi.md#get_validation_rule) | **GET** /v1/validation-rules/{validationRuleId} | Get Validation Rule +*ValidationRulesApi* | [**list_validation_rule_assignments**](docs/ValidationRulesApi.md#list_validation_rule_assignments) | **GET** /v1/validation-rules/{validationRuleId}/assignments | List Validation Rule Assignments +*ValidationRulesApi* | [**list_validation_rules**](docs/ValidationRulesApi.md#list_validation_rules) | **GET** /v1/validation-rules | List Validation Rules +*ValidationRulesApi* | [**list_validation_rules_assignments**](docs/ValidationRulesApi.md#list_validation_rules_assignments) | **GET** /v1/validation-rules-assignments | List Validation Rules' Assignment(s) +*ValidationRulesApi* | [**update_validation_rule**](docs/ValidationRulesApi.md#update_validation_rule) | **PUT** /v1/validation-rules/{validationRuleId} | Update Validation Rule +*ValidationsApi* | [**validate_stacked_discounts**](docs/ValidationsApi.md#validate_stacked_discounts) | **POST** /v1/validations | Validate Stackable Discounts +*VouchersApi* | [**create_voucher**](docs/VouchersApi.md#create_voucher) | **POST** /v1/vouchers/{code} | Create Voucher +*VouchersApi* | [**delete_voucher**](docs/VouchersApi.md#delete_voucher) | **DELETE** /v1/vouchers/{code} | Delete Voucher +*VouchersApi* | [**disable_voucher**](docs/VouchersApi.md#disable_voucher) | **POST** /v1/vouchers/{code}/disable | Disable Voucher +*VouchersApi* | [**enable_voucher**](docs/VouchersApi.md#enable_voucher) | **POST** /v1/vouchers/{code}/enable | Enable Voucher +*VouchersApi* | [**export_voucher_transactions**](docs/VouchersApi.md#export_voucher_transactions) | **POST** /v1/vouchers/{code}/transactions/export | Export Voucher Transactions +*VouchersApi* | [**generate_random_code**](docs/VouchersApi.md#generate_random_code) | **POST** /v1/vouchers | Generate Random Code +*VouchersApi* | [**get_voucher**](docs/VouchersApi.md#get_voucher) | **GET** /v1/vouchers/{code} | Get Voucher +*VouchersApi* | [**import_vouchers**](docs/VouchersApi.md#import_vouchers) | **POST** /v1/vouchers/import | Import Vouchers +*VouchersApi* | [**import_vouchers_using_csv**](docs/VouchersApi.md#import_vouchers_using_csv) | **POST** /v1/vouchers/importCSV | Import Vouchers using CSV +*VouchersApi* | [**list_voucher_transactions**](docs/VouchersApi.md#list_voucher_transactions) | **GET** /v1/vouchers/{code}/transactions | List Voucher Transactions +*VouchersApi* | [**list_vouchers**](docs/VouchersApi.md#list_vouchers) | **GET** /v1/vouchers | List Vouchers +*VouchersApi* | [**release_validation_session**](docs/VouchersApi.md#release_validation_session) | **DELETE** /v1/vouchers/{code}/sessions/{sessionKey} | Release Validation Session +*VouchersApi* | [**update_voucher**](docs/VouchersApi.md#update_voucher) | **PUT** /v1/vouchers/{code} | Update Voucher +*VouchersApi* | [**update_voucher_balance**](docs/VouchersApi.md#update_voucher_balance) | **POST** /v1/vouchers/{code}/balance | Add or Remove Voucher Balance +*VouchersApi* | [**update_vouchers_in_bulk**](docs/VouchersApi.md#update_vouchers_in_bulk) | **POST** /v1/vouchers/bulk/async | Update Vouchers in Bulk +*VouchersApi* | [**update_vouchers_metadata_in_bulk**](docs/VouchersApi.md#update_vouchers_metadata_in_bulk) | **POST** /v1/vouchers/metadata/async | Update Vouchers' Metadata in Bulk + + +## Documentation For Models + + - [AccessSettingsCampaignAssignmentsList](docs/AccessSettingsCampaignAssignmentsList.md) + - [ApplicableTo](docs/ApplicableTo.md) + - [ApplicableToEffect](docs/ApplicableToEffect.md) + - [ApplicableToResultList](docs/ApplicableToResultList.md) + - [AreaStoreCampaignAssignment](docs/AreaStoreCampaignAssignment.md) + - [AsyncActionBase](docs/AsyncActionBase.md) + - [AsyncActionGetResponseBody](docs/AsyncActionGetResponseBody.md) + - [AsyncActionsListResponseBody](docs/AsyncActionsListResponseBody.md) + - [BusValRuleAssignment](docs/BusValRuleAssignment.md) + - [CampaignBase](docs/CampaignBase.md) + - [CampaignLoyaltyCard](docs/CampaignLoyaltyCard.md) + - [CampaignLoyaltyCardExpirationRules](docs/CampaignLoyaltyCardExpirationRules.md) + - [CampaignLoyaltyVoucher](docs/CampaignLoyaltyVoucher.md) + - [CampaignLoyaltyVoucherRedemption](docs/CampaignLoyaltyVoucherRedemption.md) + - [CampaignVoucher](docs/CampaignVoucher.md) + - [CampaignVoucherRedemption](docs/CampaignVoucherRedemption.md) + - [CampaignsCreateRequestBody](docs/CampaignsCreateRequestBody.md) + - [CampaignsCreateRequestBodyPromotion](docs/CampaignsCreateRequestBodyPromotion.md) + - [CampaignsCreateRequestBodyVoucher](docs/CampaignsCreateRequestBodyVoucher.md) + - [CampaignsCreateRequestBodyVoucherRedemption](docs/CampaignsCreateRequestBodyVoucherRedemption.md) + - [CampaignsCreateResponseBody](docs/CampaignsCreateResponseBody.md) + - [CampaignsDeleteResponseBody](docs/CampaignsDeleteResponseBody.md) + - [CampaignsGetResponseBody](docs/CampaignsGetResponseBody.md) + - [CampaignsImportCreateResponseBody](docs/CampaignsImportCreateResponseBody.md) + - [CampaignsImportCsvCreateResponseBody](docs/CampaignsImportCsvCreateResponseBody.md) + - [CampaignsImportVoucherItem](docs/CampaignsImportVoucherItem.md) + - [CampaignsImportVoucherItemRedemption](docs/CampaignsImportVoucherItemRedemption.md) + - [CampaignsListResponseBody](docs/CampaignsListResponseBody.md) + - [CampaignsUpdateRequestBody](docs/CampaignsUpdateRequestBody.md) + - [CampaignsUpdateRequestBodyOptions](docs/CampaignsUpdateRequestBodyOptions.md) + - [CampaignsUpdateResponseBody](docs/CampaignsUpdateResponseBody.md) + - [CampaignsVouchersCreateCombinedResponseBody](docs/CampaignsVouchersCreateCombinedResponseBody.md) + - [CampaignsVouchersCreateCombinedResponseBodyGift](docs/CampaignsVouchersCreateCombinedResponseBodyGift.md) + - [CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard](docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md) + - [CampaignsVouchersCreateCombinedResponseBodyPublish](docs/CampaignsVouchersCreateCombinedResponseBodyPublish.md) + - [CampaignsVouchersCreateCombinedResponseBodyRedemption](docs/CampaignsVouchersCreateCombinedResponseBodyRedemption.md) + - [CampaignsVouchersCreateInBulkRequestBody](docs/CampaignsVouchersCreateInBulkRequestBody.md) + - [CampaignsVouchersCreateInBulkRequestBodyRedemption](docs/CampaignsVouchersCreateInBulkRequestBodyRedemption.md) + - [CampaignsVouchersCreateRequestBody](docs/CampaignsVouchersCreateRequestBody.md) + - [CampaignsVouchersCreateRequestBodyRedemption](docs/CampaignsVouchersCreateRequestBodyRedemption.md) + - [CampaignsVouchersCreateResponseBody](docs/CampaignsVouchersCreateResponseBody.md) + - [CampaignsVouchersCreateResponseBodyGift](docs/CampaignsVouchersCreateResponseBodyGift.md) + - [CampaignsVouchersCreateResponseBodyLoyaltyCard](docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md) + - [CampaignsVouchersCreateResponseBodyPublish](docs/CampaignsVouchersCreateResponseBodyPublish.md) + - [CampaignsVouchersCreateResponseBodyRedemption](docs/CampaignsVouchersCreateResponseBodyRedemption.md) + - [CategoriesCreateRequestBody](docs/CategoriesCreateRequestBody.md) + - [CategoriesCreateResponseBody](docs/CategoriesCreateResponseBody.md) + - [CategoriesGetResponseBody](docs/CategoriesGetResponseBody.md) + - [CategoriesListResponseBody](docs/CategoriesListResponseBody.md) + - [CategoriesUpdateRequestBody](docs/CategoriesUpdateRequestBody.md) + - [CategoriesUpdateResponseBody](docs/CategoriesUpdateResponseBody.md) + - [Category](docs/Category.md) + - [ClientEventsCreateRequestBody](docs/ClientEventsCreateRequestBody.md) + - [ClientEventsCreateRequestBodyLoyalty](docs/ClientEventsCreateRequestBodyLoyalty.md) + - [ClientEventsCreateRequestBodyReferral](docs/ClientEventsCreateRequestBodyReferral.md) + - [ClientEventsCreateResponseBody](docs/ClientEventsCreateResponseBody.md) + - [ClientPromotionsTiersListResponseBody](docs/ClientPromotionsTiersListResponseBody.md) + - [ClientQualificationsCheckEligibilityRequestBody](docs/ClientQualificationsCheckEligibilityRequestBody.md) + - [ClientQualificationsCheckEligibilityResponseBody](docs/ClientQualificationsCheckEligibilityResponseBody.md) + - [ClientRedemptionsRedeemRequestBody](docs/ClientRedemptionsRedeemRequestBody.md) + - [ClientRedemptionsRedeemRequestBodyOptions](docs/ClientRedemptionsRedeemRequestBodyOptions.md) + - [ClientRedemptionsRedeemRequestBodyRedeemablesItem](docs/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md) + - [ClientRedemptionsRedeemRequestBodyRedeemablesItemGift](docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md) + - [ClientRedemptionsRedeemRequestBodyRedeemablesItemReward](docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md) + - [ClientRedemptionsRedeemResponseBody](docs/ClientRedemptionsRedeemResponseBody.md) + - [ClientValidationsValidateRequestBody](docs/ClientValidationsValidateRequestBody.md) + - [ClientValidationsValidateRequestBodyOptions](docs/ClientValidationsValidateRequestBodyOptions.md) + - [ClientValidationsValidateRequestBodyRedeemablesItem](docs/ClientValidationsValidateRequestBodyRedeemablesItem.md) + - [ClientValidationsValidateRequestBodyRedeemablesItemGift](docs/ClientValidationsValidateRequestBodyRedeemablesItemGift.md) + - [ClientValidationsValidateRequestBodyRedeemablesItemReward](docs/ClientValidationsValidateRequestBodyRedeemablesItemReward.md) + - [ClientValidationsValidateResponseBody](docs/ClientValidationsValidateResponseBody.md) + - [ClientValidationsValidateResponseBodyRedeemablesItem](docs/ClientValidationsValidateResponseBodyRedeemablesItem.md) + - [ClientValidationsValidateResponseBodyRedeemablesItemResult](docs/ClientValidationsValidateResponseBodyRedeemablesItemResult.md) + - [ClientValidationsValidateResponseBodyRedeemablesItemResultDetails](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md) + - [ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) + - [ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) + - [ClientValidationsValidateResponseBodyRedeemablesItemResultGift](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md) + - [ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard](docs/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) + - [CodeConfig](docs/CodeConfig.md) + - [CreatePublicationCampaign](docs/CreatePublicationCampaign.md) + - [Customer](docs/Customer.md) + - [CustomerActivity](docs/CustomerActivity.md) + - [CustomerAddress](docs/CustomerAddress.md) + - [CustomerId](docs/CustomerId.md) + - [CustomerLoyalty](docs/CustomerLoyalty.md) + - [CustomerRedeemable](docs/CustomerRedeemable.md) + - [CustomerRedeemableRedeemable](docs/CustomerRedeemableRedeemable.md) + - [CustomerReferrals](docs/CustomerReferrals.md) + - [CustomerReferralsCampaignsItem](docs/CustomerReferralsCampaignsItem.md) + - [CustomerSummary](docs/CustomerSummary.md) + - [CustomerSummaryOrders](docs/CustomerSummaryOrders.md) + - [CustomerSummaryRedemptions](docs/CustomerSummaryRedemptions.md) + - [CustomerSummaryRedemptionsGift](docs/CustomerSummaryRedemptionsGift.md) + - [CustomerSummaryRedemptionsLoyaltyCard](docs/CustomerSummaryRedemptionsLoyaltyCard.md) + - [CustomerWithSummaryLoyaltyReferrals](docs/CustomerWithSummaryLoyaltyReferrals.md) + - [CustomerWithSummaryLoyaltyReferralsAddress](docs/CustomerWithSummaryLoyaltyReferralsAddress.md) + - [CustomerWithSummaryLoyaltyReferralsAssets](docs/CustomerWithSummaryLoyaltyReferralsAssets.md) + - [CustomersActivityListResponseBody](docs/CustomersActivityListResponseBody.md) + - [CustomersCreateRequestBody](docs/CustomersCreateRequestBody.md) + - [CustomersCreateRequestBodyAddress](docs/CustomersCreateRequestBodyAddress.md) + - [CustomersCreateResponseBody](docs/CustomersCreateResponseBody.md) + - [CustomersCreateResponseBodyAddress](docs/CustomersCreateResponseBodyAddress.md) + - [CustomersCreateResponseBodyAssets](docs/CustomersCreateResponseBodyAssets.md) + - [CustomersGetResponseBody](docs/CustomersGetResponseBody.md) + - [CustomersGetResponseBodyAddress](docs/CustomersGetResponseBodyAddress.md) + - [CustomersGetResponseBodyAssets](docs/CustomersGetResponseBodyAssets.md) + - [CustomersImportCsvCreateResponseBody](docs/CustomersImportCsvCreateResponseBody.md) + - [CustomersListResponseBody](docs/CustomersListResponseBody.md) + - [CustomersMetadataUpdateInBulkRequestBody](docs/CustomersMetadataUpdateInBulkRequestBody.md) + - [CustomersMetadataUpdateInBulkResponseBody](docs/CustomersMetadataUpdateInBulkResponseBody.md) + - [CustomersPermanentDeletionCreateResponseBody](docs/CustomersPermanentDeletionCreateResponseBody.md) + - [CustomersPermanentDeletionCreateResponseBodyDataJson](docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md) + - [CustomersRedeemablesListResponseBody](docs/CustomersRedeemablesListResponseBody.md) + - [CustomersSegmentsListResponseBody](docs/CustomersSegmentsListResponseBody.md) + - [CustomersUpdateInBulkRequestBody](docs/CustomersUpdateInBulkRequestBody.md) + - [CustomersUpdateInBulkRequestBodyAddress](docs/CustomersUpdateInBulkRequestBodyAddress.md) + - [CustomersUpdateInBulkResponseBody](docs/CustomersUpdateInBulkResponseBody.md) + - [CustomersUpdateRequestBody](docs/CustomersUpdateRequestBody.md) + - [CustomersUpdateRequestBodyAddress](docs/CustomersUpdateRequestBodyAddress.md) + - [CustomersUpdateResponseBody](docs/CustomersUpdateResponseBody.md) + - [CustomersUpdateResponseBodyAddress](docs/CustomersUpdateResponseBodyAddress.md) + - [CustomersUpdateResponseBodyAssets](docs/CustomersUpdateResponseBodyAssets.md) + - [Discount](docs/Discount.md) + - [DiscountUnitMultipleOneUnit](docs/DiscountUnitMultipleOneUnit.md) + - [EarningRule](docs/EarningRule.md) + - [EarningRuleCustomEvent](docs/EarningRuleCustomEvent.md) + - [EarningRuleLoyalty](docs/EarningRuleLoyalty.md) + - [EarningRuleLoyaltyCustomEvent](docs/EarningRuleLoyaltyCustomEvent.md) + - [EarningRuleLoyaltyCustomEventMetadata](docs/EarningRuleLoyaltyCustomEventMetadata.md) + - [EarningRuleLoyaltyCustomer](docs/EarningRuleLoyaltyCustomer.md) + - [EarningRuleLoyaltyCustomerMetadata](docs/EarningRuleLoyaltyCustomerMetadata.md) + - [EarningRuleLoyaltyOrder](docs/EarningRuleLoyaltyOrder.md) + - [EarningRuleLoyaltyOrderAmount](docs/EarningRuleLoyaltyOrderAmount.md) + - [EarningRuleLoyaltyOrderItems](docs/EarningRuleLoyaltyOrderItems.md) + - [EarningRuleLoyaltyOrderItemsAmount](docs/EarningRuleLoyaltyOrderItemsAmount.md) + - [EarningRuleLoyaltyOrderItemsQuantity](docs/EarningRuleLoyaltyOrderItemsQuantity.md) + - [EarningRuleLoyaltyOrderItemsSubtotalAmount](docs/EarningRuleLoyaltyOrderItemsSubtotalAmount.md) + - [EarningRuleLoyaltyOrderMetadata](docs/EarningRuleLoyaltyOrderMetadata.md) + - [EarningRuleLoyaltyOrderTotalAmount](docs/EarningRuleLoyaltyOrderTotalAmount.md) + - [EarningRuleLoyaltyTier](docs/EarningRuleLoyaltyTier.md) + - [EarningRuleSegment](docs/EarningRuleSegment.md) + - [EarningRuleSource](docs/EarningRuleSource.md) + - [Error](docs/Error.md) + - [EventsCreateRequestBody](docs/EventsCreateRequestBody.md) + - [EventsCreateRequestBodyLoyalty](docs/EventsCreateRequestBodyLoyalty.md) + - [EventsCreateRequestBodyReferral](docs/EventsCreateRequestBodyReferral.md) + - [EventsCreateResponseBody](docs/EventsCreateResponseBody.md) + - [Export](docs/Export.md) + - [ExportOrderFields](docs/ExportOrderFields.md) + - [ExportOrderOrder](docs/ExportOrderOrder.md) + - [ExportParameters](docs/ExportParameters.md) + - [ExportParametersFilters](docs/ExportParametersFilters.md) + - [ExportResult](docs/ExportResult.md) + - [ExportVoucherTransactionsFields](docs/ExportVoucherTransactionsFields.md) + - [ExportVoucherTransactionsFilters](docs/ExportVoucherTransactionsFilters.md) + - [ExportVoucherTransactionsOrder](docs/ExportVoucherTransactionsOrder.md) + - [ExportsCreateRequestBody](docs/ExportsCreateRequestBody.md) + - [ExportsCreateRequestBodyParameters](docs/ExportsCreateRequestBodyParameters.md) + - [ExportsCreateRequestBodyParametersFilters](docs/ExportsCreateRequestBodyParametersFilters.md) + - [ExportsCreateResponseBody](docs/ExportsCreateResponseBody.md) + - [ExportsCreateResponseBodyParameters](docs/ExportsCreateResponseBodyParameters.md) + - [ExportsCreateResponseBodyParametersFilters](docs/ExportsCreateResponseBodyParametersFilters.md) + - [ExportsGetResponseBody](docs/ExportsGetResponseBody.md) + - [ExportsGetResponseBodyParameters](docs/ExportsGetResponseBodyParameters.md) + - [ExportsGetResponseBodyParametersFilters](docs/ExportsGetResponseBodyParametersFilters.md) + - [ExportsGetResponseBodyResult](docs/ExportsGetResponseBodyResult.md) + - [ExportsListResponseBody](docs/ExportsListResponseBody.md) + - [FieldConditions](docs/FieldConditions.md) + - [FilterConditionsString](docs/FilterConditionsString.md) + - [FiltersCondition](docs/FiltersCondition.md) + - [Gift](docs/Gift.md) + - [InapplicableTo](docs/InapplicableTo.md) + - [InapplicableToResultList](docs/InapplicableToResultList.md) + - [Junction](docs/Junction.md) + - [ListPublicationsItemVoucher](docs/ListPublicationsItemVoucher.md) + - [LoyaltiesCreateCampaignRequestBody](docs/LoyaltiesCreateCampaignRequestBody.md) + - [LoyaltiesCreateCampaignResponseBody](docs/LoyaltiesCreateCampaignResponseBody.md) + - [LoyaltiesDeleteResponseBody](docs/LoyaltiesDeleteResponseBody.md) + - [LoyaltiesEarningRulesCreateRequestBodyItem](docs/LoyaltiesEarningRulesCreateRequestBodyItem.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent](docs/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyalty](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier](docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemSegment](docs/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md) + - [LoyaltiesEarningRulesCreateRequestBodyItemSource](docs/LoyaltiesEarningRulesCreateRequestBodyItemSource.md) + - [LoyaltiesEarningRulesCreateResponseBody](docs/LoyaltiesEarningRulesCreateResponseBody.md) + - [LoyaltiesEarningRulesCreateResponseBodyCustomEvent](docs/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyalty](docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md) + - [LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md) + - [LoyaltiesEarningRulesCreateResponseBodySegment](docs/LoyaltiesEarningRulesCreateResponseBodySegment.md) + - [LoyaltiesEarningRulesCreateResponseBodySource](docs/LoyaltiesEarningRulesCreateResponseBodySource.md) + - [LoyaltiesEarningRulesDisableResponseBody](docs/LoyaltiesEarningRulesDisableResponseBody.md) + - [LoyaltiesEarningRulesDisableResponseBodyCustomEvent](docs/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyalty](docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md) + - [LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md) + - [LoyaltiesEarningRulesDisableResponseBodySegment](docs/LoyaltiesEarningRulesDisableResponseBodySegment.md) + - [LoyaltiesEarningRulesDisableResponseBodySource](docs/LoyaltiesEarningRulesDisableResponseBodySource.md) + - [LoyaltiesEarningRulesEnableResponseBody](docs/LoyaltiesEarningRulesEnableResponseBody.md) + - [LoyaltiesEarningRulesEnableResponseBodyCustomEvent](docs/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyalty](docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md) + - [LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md) + - [LoyaltiesEarningRulesEnableResponseBodySegment](docs/LoyaltiesEarningRulesEnableResponseBodySegment.md) + - [LoyaltiesEarningRulesEnableResponseBodySource](docs/LoyaltiesEarningRulesEnableResponseBodySource.md) + - [LoyaltiesEarningRulesGetResponseBody](docs/LoyaltiesEarningRulesGetResponseBody.md) + - [LoyaltiesEarningRulesGetResponseBodyCustomEvent](docs/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyalty](docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md) + - [LoyaltiesEarningRulesGetResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md) + - [LoyaltiesEarningRulesGetResponseBodySegment](docs/LoyaltiesEarningRulesGetResponseBodySegment.md) + - [LoyaltiesEarningRulesGetResponseBodySource](docs/LoyaltiesEarningRulesGetResponseBodySource.md) + - [LoyaltiesEarningRulesListResponseBody](docs/LoyaltiesEarningRulesListResponseBody.md) + - [LoyaltiesEarningRulesUpdateRequestBody](docs/LoyaltiesEarningRulesUpdateRequestBody.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyalty](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md) + - [LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md) + - [LoyaltiesEarningRulesUpdateRequestBodySource](docs/LoyaltiesEarningRulesUpdateRequestBodySource.md) + - [LoyaltiesEarningRulesUpdateResponseBody](docs/LoyaltiesEarningRulesUpdateResponseBody.md) + - [LoyaltiesEarningRulesUpdateResponseBodyCustomEvent](docs/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyalty](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md) + - [LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier](docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md) + - [LoyaltiesEarningRulesUpdateResponseBodySegment](docs/LoyaltiesEarningRulesUpdateResponseBodySegment.md) + - [LoyaltiesEarningRulesUpdateResponseBodySource](docs/LoyaltiesEarningRulesUpdateResponseBodySource.md) + - [LoyaltiesGetCampaignResponseBody](docs/LoyaltiesGetCampaignResponseBody.md) + - [LoyaltiesListCampaignsResponseBody](docs/LoyaltiesListCampaignsResponseBody.md) + - [LoyaltiesListMembersResponseBody](docs/LoyaltiesListMembersResponseBody.md) + - [LoyaltiesLoyaltyTierReward](docs/LoyaltiesLoyaltyTierReward.md) + - [LoyaltiesMemberActivityListResponseBody](docs/LoyaltiesMemberActivityListResponseBody.md) + - [LoyaltiesMembersBalanceUpdateRequestBody](docs/LoyaltiesMembersBalanceUpdateRequestBody.md) + - [LoyaltiesMembersBalanceUpdateResponseBody](docs/LoyaltiesMembersBalanceUpdateResponseBody.md) + - [LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject](docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md) + - [LoyaltiesMembersCreateRequestBody](docs/LoyaltiesMembersCreateRequestBody.md) + - [LoyaltiesMembersCreateResponseBody](docs/LoyaltiesMembersCreateResponseBody.md) + - [LoyaltiesMembersCreateResponseBodyLoyaltyCard](docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md) + - [LoyaltiesMembersCreateResponseBodyPublish](docs/LoyaltiesMembersCreateResponseBodyPublish.md) + - [LoyaltiesMembersCreateResponseBodyRedemption](docs/LoyaltiesMembersCreateResponseBodyRedemption.md) + - [LoyaltiesMembersGetResponseBody](docs/LoyaltiesMembersGetResponseBody.md) + - [LoyaltiesMembersGetResponseBodyLoyaltyCard](docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md) + - [LoyaltiesMembersGetResponseBodyPublish](docs/LoyaltiesMembersGetResponseBodyPublish.md) + - [LoyaltiesMembersGetResponseBodyRedemption](docs/LoyaltiesMembersGetResponseBodyRedemption.md) + - [LoyaltiesMembersPointsExpirationListResponseBody](docs/LoyaltiesMembersPointsExpirationListResponseBody.md) + - [LoyaltiesMembersPointsExpirationListResponseBodyDataItem](docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md) + - [LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket](docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md) + - [LoyaltiesMembersRedemptionRedeemRequestBody](docs/LoyaltiesMembersRedemptionRedeemRequestBody.md) + - [LoyaltiesMembersRedemptionRedeemRequestBodyReward](docs/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md) + - [LoyaltiesMembersRedemptionRedeemResponseBody](docs/LoyaltiesMembersRedemptionRedeemResponseBody.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyChannel](docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyGift](docs/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard](docs/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions](docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem](docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem](docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyVoucher](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md) + - [LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption](docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md) + - [LoyaltiesMembersRewardsListResponseBody](docs/LoyaltiesMembersRewardsListResponseBody.md) + - [LoyaltiesMembersRewardsListResponseBodyDataItem](docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md) + - [LoyaltiesMembersTiersListResponseBody](docs/LoyaltiesMembersTiersListResponseBody.md) + - [LoyaltiesMembersTransactionsExportCreateRequestBody](docs/LoyaltiesMembersTransactionsExportCreateRequestBody.md) + - [LoyaltiesMembersTransactionsExportCreateRequestBodyParameters](docs/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) + - [LoyaltiesMembersTransactionsExportCreateResponseBody](docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md) + - [LoyaltiesMembersTransactionsExportCreateResponseBodyParameters](docs/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md) + - [LoyaltiesMembersTransactionsListResponseBody](docs/LoyaltiesMembersTransactionsListResponseBody.md) + - [LoyaltiesMembersTransfersCreateResponseBody](docs/LoyaltiesMembersTransfersCreateResponseBody.md) + - [LoyaltiesMembersTransfersCreateResponseBodyAssets](docs/LoyaltiesMembersTransfersCreateResponseBodyAssets.md) + - [LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode](docs/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md) + - [LoyaltiesMembersTransfersCreateResponseBodyAssetsQr](docs/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md) + - [LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard](docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md) + - [LoyaltiesMembersTransfersCreateResponseBodyPublish](docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md) + - [LoyaltiesMembersTransfersCreateResponseBodyRedemption](docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md) + - [LoyaltiesPointsExpirationExportCreateRequestBody](docs/LoyaltiesPointsExpirationExportCreateRequestBody.md) + - [LoyaltiesPointsExpirationExportCreateRequestBodyParameters](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md) + - [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md) + - [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md) + - [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md) + - [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md) + - [LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions](docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md) + - [LoyaltiesPointsExpirationExportCreateResponseBody](docs/LoyaltiesPointsExpirationExportCreateResponseBody.md) + - [LoyaltiesPointsExpirationExportCreateResponseBodyParameters](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md) + - [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md) + - [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md) + - [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md) + - [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md) + - [LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions](docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md) + - [LoyaltiesRewardAssignmentsGetResponseBody](docs/LoyaltiesRewardAssignmentsGetResponseBody.md) + - [LoyaltiesRewardAssignmentsGetResponseBodyParameters](docs/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md) + - [LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty](docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md) + - [LoyaltiesRewardAssignmentsListResponseBody](docs/LoyaltiesRewardAssignmentsListResponseBody.md) + - [LoyaltiesRewardAssignmentsRewardGetResponseBody](docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md) + - [LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes](docs/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md) + - [LoyaltiesRewardsCreateAssignmentItemRequestBody](docs/LoyaltiesRewardsCreateAssignmentItemRequestBody.md) + - [LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters](docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md) + - [LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty](docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md) + - [LoyaltiesRewardsCreateAssignmentResponseBody](docs/LoyaltiesRewardsCreateAssignmentResponseBody.md) + - [LoyaltiesRewardsCreateAssignmentResponseBodyParameters](docs/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md) + - [LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty](docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md) + - [LoyaltiesRewardsGetResponseBody](docs/LoyaltiesRewardsGetResponseBody.md) + - [LoyaltiesRewardsGetResponseBodyParameters](docs/LoyaltiesRewardsGetResponseBodyParameters.md) + - [LoyaltiesRewardsGetResponseBodyParametersLoyalty](docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md) + - [LoyaltiesRewardsListAssignmentsResponseBody](docs/LoyaltiesRewardsListAssignmentsResponseBody.md) + - [LoyaltiesRewardsUpdateAssignmentRequestBody](docs/LoyaltiesRewardsUpdateAssignmentRequestBody.md) + - [LoyaltiesRewardsUpdateAssignmentRequestBodyParameters](docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md) + - [LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty](docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md) + - [LoyaltiesRewardsUpdateAssignmentResponseBody](docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md) + - [LoyaltiesRewardsUpdateAssignmentResponseBodyParameters](docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md) + - [LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty](docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md) + - [LoyaltiesTiersCreateInBulkRequestBodyItem](docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md) + - [LoyaltiesTiersEarningRulesListResponseBody](docs/LoyaltiesTiersEarningRulesListResponseBody.md) + - [LoyaltiesTiersGetResponseBody](docs/LoyaltiesTiersGetResponseBody.md) + - [LoyaltiesTiersGetResponseBodyConfig](docs/LoyaltiesTiersGetResponseBodyConfig.md) + - [LoyaltiesTiersGetResponseBodyConfigPoints](docs/LoyaltiesTiersGetResponseBodyConfigPoints.md) + - [LoyaltiesTiersGetResponseBodyPoints](docs/LoyaltiesTiersGetResponseBodyPoints.md) + - [LoyaltiesTiersListResponseBody](docs/LoyaltiesTiersListResponseBody.md) + - [LoyaltiesTiersRewardsListResponseBody](docs/LoyaltiesTiersRewardsListResponseBody.md) + - [LoyaltiesTransferPoints](docs/LoyaltiesTransferPoints.md) + - [LoyaltiesUpdateCampaignRequestBody](docs/LoyaltiesUpdateCampaignRequestBody.md) + - [LoyaltiesUpdateCampaignRequestBodyOptions](docs/LoyaltiesUpdateCampaignRequestBodyOptions.md) + - [LoyaltiesUpdateCampaignResponseBody](docs/LoyaltiesUpdateCampaignResponseBody.md) + - [LoyaltyCampaign](docs/LoyaltyCampaign.md) + - [LoyaltyCampaignVoucher](docs/LoyaltyCampaignVoucher.md) + - [LoyaltyCampaignVoucherRedemption](docs/LoyaltyCampaignVoucherRedemption.md) + - [LoyaltyCardTransaction](docs/LoyaltyCardTransaction.md) + - [LoyaltyCardTransactionDetails](docs/LoyaltyCardTransactionDetails.md) + - [LoyaltyCardTransactionDetailsBalance](docs/LoyaltyCardTransactionDetailsBalance.md) + - [LoyaltyCardTransactionDetailsBalanceRelatedObject](docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md) + - [LoyaltyCardTransactionDetailsCustomEvent](docs/LoyaltyCardTransactionDetailsCustomEvent.md) + - [LoyaltyCardTransactionDetailsEarningRule](docs/LoyaltyCardTransactionDetailsEarningRule.md) + - [LoyaltyCardTransactionDetailsEarningRuleSource](docs/LoyaltyCardTransactionDetailsEarningRuleSource.md) + - [LoyaltyCardTransactionDetailsEvent](docs/LoyaltyCardTransactionDetailsEvent.md) + - [LoyaltyCardTransactionDetailsEventSchema](docs/LoyaltyCardTransactionDetailsEventSchema.md) + - [LoyaltyCardTransactionDetailsLoyaltyTier](docs/LoyaltyCardTransactionDetailsLoyaltyTier.md) + - [LoyaltyCardTransactionDetailsOrder](docs/LoyaltyCardTransactionDetailsOrder.md) + - [LoyaltyCardTransactionDetailsRedemption](docs/LoyaltyCardTransactionDetailsRedemption.md) + - [LoyaltyCardTransactionDetailsReward](docs/LoyaltyCardTransactionDetailsReward.md) + - [LoyaltyCardTransactionDetailsRollback](docs/LoyaltyCardTransactionDetailsRollback.md) + - [LoyaltyCardTransactionDetailsSegment](docs/LoyaltyCardTransactionDetailsSegment.md) + - [LoyaltyCardTransactionsType](docs/LoyaltyCardTransactionsType.md) + - [LoyaltyMember](docs/LoyaltyMember.md) + - [LoyaltyMemberLoyaltyCard](docs/LoyaltyMemberLoyaltyCard.md) + - [LoyaltyMemberPublish](docs/LoyaltyMemberPublish.md) + - [LoyaltyMemberRedemption](docs/LoyaltyMemberRedemption.md) + - [LoyaltyTier](docs/LoyaltyTier.md) + - [LoyaltyTierBase](docs/LoyaltyTierBase.md) + - [LoyaltyTierBasePoints](docs/LoyaltyTierBasePoints.md) + - [LoyaltyTierConfig](docs/LoyaltyTierConfig.md) + - [LoyaltyTierConfigPoints](docs/LoyaltyTierConfigPoints.md) + - [LoyaltyTierExpiration](docs/LoyaltyTierExpiration.md) + - [LoyaltyTierPoints](docs/LoyaltyTierPoints.md) + - [LoyaltyTiersExpirationAll](docs/LoyaltyTiersExpirationAll.md) + - [LoyaltyTiersExpirationAllExpirationDate](docs/LoyaltyTiersExpirationAllExpirationDate.md) + - [LoyaltyTiersExpirationAllExpirationDateRounding](docs/LoyaltyTiersExpirationAllExpirationDateRounding.md) + - [LoyaltyTiersExpirationAllStartDate](docs/LoyaltyTiersExpirationAllStartDate.md) + - [LuckyDraw](docs/LuckyDraw.md) + - [MemberActivity](docs/MemberActivity.md) + - [Order](docs/Order.md) + - [OrderCalculated](docs/OrderCalculated.md) + - [OrderCalculatedItem](docs/OrderCalculatedItem.md) + - [OrderCalculatedItemProduct](docs/OrderCalculatedItemProduct.md) + - [OrderCalculatedItemSku](docs/OrderCalculatedItemSku.md) + - [OrderItem](docs/OrderItem.md) + - [OrderItemProduct](docs/OrderItemProduct.md) + - [OrderItemSku](docs/OrderItemSku.md) + - [OrdersCreateRequestBody](docs/OrdersCreateRequestBody.md) + - [OrdersCreateResponseBody](docs/OrdersCreateResponseBody.md) + - [OrdersExportCreateRequestBody](docs/OrdersExportCreateRequestBody.md) + - [OrdersExportCreateRequestBodyParameters](docs/OrdersExportCreateRequestBodyParameters.md) + - [OrdersExportCreateResponseBody](docs/OrdersExportCreateResponseBody.md) + - [OrdersExportCreateResponseBodyParameters](docs/OrdersExportCreateResponseBodyParameters.md) + - [OrdersGetResponseBody](docs/OrdersGetResponseBody.md) + - [OrdersImportCreateRequestBodyItem](docs/OrdersImportCreateRequestBodyItem.md) + - [OrdersImportCreateResponseBody](docs/OrdersImportCreateResponseBody.md) + - [OrdersListResponseBody](docs/OrdersListResponseBody.md) + - [OrdersUpdateRequestBody](docs/OrdersUpdateRequestBody.md) + - [OrdersUpdateResponseBody](docs/OrdersUpdateResponseBody.md) + - [ParameterActivityCategory](docs/ParameterActivityCategory.md) + - [ParameterCampaignType](docs/ParameterCampaignType.md) + - [ParameterCreatedBeforeAfter](docs/ParameterCreatedBeforeAfter.md) + - [ParameterExpandListCampaigns](docs/ParameterExpandListCampaigns.md) + - [ParameterFiltersListCustomerRedeemables](docs/ParameterFiltersListCustomerRedeemables.md) + - [ParameterFiltersListCustomerRedeemablesCampaignId](docs/ParameterFiltersListCustomerRedeemablesCampaignId.md) + - [ParameterFiltersListCustomerRedeemablesCampaignType](docs/ParameterFiltersListCustomerRedeemablesCampaignType.md) + - [ParameterFiltersListCustomerRedeemablesCampaignTypeConditions](docs/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md) + - [ParameterFiltersListCustomerRedeemablesCreatedAt](docs/ParameterFiltersListCustomerRedeemablesCreatedAt.md) + - [ParameterFiltersListCustomerRedeemablesCreatedAtConditions](docs/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md) + - [ParameterFiltersListCustomerRedeemablesHolderRole](docs/ParameterFiltersListCustomerRedeemablesHolderRole.md) + - [ParameterFiltersListCustomerRedeemablesHolderRoleConditions](docs/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md) + - [ParameterFiltersListCustomerRedeemablesId](docs/ParameterFiltersListCustomerRedeemablesId.md) + - [ParameterFiltersListCustomerRedeemablesRedeemableId](docs/ParameterFiltersListCustomerRedeemablesRedeemableId.md) + - [ParameterFiltersListCustomerRedeemablesRedeemableObject](docs/ParameterFiltersListCustomerRedeemablesRedeemableObject.md) + - [ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions](docs/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md) + - [ParameterFiltersListCustomerRedeemablesVoucherType](docs/ParameterFiltersListCustomerRedeemablesVoucherType.md) + - [ParameterFiltersListCustomerRedeemablesVoucherTypeConditions](docs/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md) + - [ParameterFiltersListRedemptions](docs/ParameterFiltersListRedemptions.md) + - [ParameterFiltersListRedemptionsCampaignName](docs/ParameterFiltersListRedemptionsCampaignName.md) + - [ParameterFiltersListRedemptionsCustomerId](docs/ParameterFiltersListRedemptionsCustomerId.md) + - [ParameterFiltersListRedemptionsFailureCode](docs/ParameterFiltersListRedemptionsFailureCode.md) + - [ParameterFiltersListRedemptionsObject](docs/ParameterFiltersListRedemptionsObject.md) + - [ParameterFiltersListRedemptionsParentRedemptionId](docs/ParameterFiltersListRedemptionsParentRedemptionId.md) + - [ParameterFiltersListRedemptionsRelatedObjectId](docs/ParameterFiltersListRedemptionsRelatedObjectId.md) + - [ParameterFiltersListRedemptionsRelatedObjectParentId](docs/ParameterFiltersListRedemptionsRelatedObjectParentId.md) + - [ParameterFiltersListRedemptionsResult](docs/ParameterFiltersListRedemptionsResult.md) + - [ParameterFiltersListRedemptionsUserLogin](docs/ParameterFiltersListRedemptionsUserLogin.md) + - [ParameterFiltersListRedemptionsVoucherCode](docs/ParameterFiltersListRedemptionsVoucherCode.md) + - [ParameterOrder](docs/ParameterOrder.md) + - [ParameterOrderCreatedAt](docs/ParameterOrderCreatedAt.md) + - [ParameterOrderListAllPromotionStacks](docs/ParameterOrderListAllPromotionStacks.md) + - [ParameterOrderListCampaigns](docs/ParameterOrderListCampaigns.md) + - [ParameterOrderListCustomers](docs/ParameterOrderListCustomers.md) + - [ParameterOrderListEarningRules](docs/ParameterOrderListEarningRules.md) + - [ParameterOrderListExports](docs/ParameterOrderListExports.md) + - [ParameterOrderListLoyaltyTiers](docs/ParameterOrderListLoyaltyTiers.md) + - [ParameterOrderListOrders](docs/ParameterOrderListOrders.md) + - [ParameterOrderListPromotionTiers](docs/ParameterOrderListPromotionTiers.md) + - [ParameterOrderListPromotionTiersClientSide](docs/ParameterOrderListPromotionTiersClientSide.md) + - [ParameterOrderListPublications](docs/ParameterOrderListPublications.md) + - [ParameterOrderListRedeemables](docs/ParameterOrderListRedeemables.md) + - [ParameterOrderListRedemptions](docs/ParameterOrderListRedemptions.md) + - [ParameterOrderListTransactions](docs/ParameterOrderListTransactions.md) + - [ParameterOrderListValidationRuleAssignments](docs/ParameterOrderListValidationRuleAssignments.md) + - [ParameterOrderListValidationRules](docs/ParameterOrderListValidationRules.md) + - [ParameterOrderVouchers](docs/ParameterOrderVouchers.md) + - [ParameterResultListPublications](docs/ParameterResultListPublications.md) + - [ParameterUpdatedBeforeAfter](docs/ParameterUpdatedBeforeAfter.md) + - [ParameterVoucherTypeListPublications](docs/ParameterVoucherTypeListPublications.md) + - [PointsExpirationTypes](docs/PointsExpirationTypes.md) + - [Product](docs/Product.md) + - [ProductCollectionsCreateRequestBody](docs/ProductCollectionsCreateRequestBody.md) + - [ProductCollectionsCreateRequestBodyFilter](docs/ProductCollectionsCreateRequestBodyFilter.md) + - [ProductCollectionsCreateRequestBodyProductsItem](docs/ProductCollectionsCreateRequestBodyProductsItem.md) + - [ProductCollectionsCreateResponseBody](docs/ProductCollectionsCreateResponseBody.md) + - [ProductCollectionsCreateResponseBodyFilter](docs/ProductCollectionsCreateResponseBodyFilter.md) + - [ProductCollectionsCreateResponseBodyProductsItem](docs/ProductCollectionsCreateResponseBodyProductsItem.md) + - [ProductCollectionsGetResponseBody](docs/ProductCollectionsGetResponseBody.md) + - [ProductCollectionsGetResponseBodyFilter](docs/ProductCollectionsGetResponseBodyFilter.md) + - [ProductCollectionsGetResponseBodyProductsItem](docs/ProductCollectionsGetResponseBodyProductsItem.md) + - [ProductCollectionsItem](docs/ProductCollectionsItem.md) + - [ProductCollectionsItemFilter](docs/ProductCollectionsItemFilter.md) + - [ProductCollectionsItemProductsItem](docs/ProductCollectionsItemProductsItem.md) + - [ProductCollectionsListResponseBody](docs/ProductCollectionsListResponseBody.md) + - [ProductCollectionsProductsListResponseBody](docs/ProductCollectionsProductsListResponseBody.md) + - [ProductCollectionsProductsListResponseBodyDataItem](docs/ProductCollectionsProductsListResponseBodyDataItem.md) + - [ProductWithoutSkus](docs/ProductWithoutSkus.md) + - [ProductsCreateRequestBody](docs/ProductsCreateRequestBody.md) + - [ProductsCreateResponseBody](docs/ProductsCreateResponseBody.md) + - [ProductsGetResponseBody](docs/ProductsGetResponseBody.md) + - [ProductsImportCsvCreateResponseBody](docs/ProductsImportCsvCreateResponseBody.md) + - [ProductsListResponseBody](docs/ProductsListResponseBody.md) + - [ProductsMetadataUpdateInBulkRequestBody](docs/ProductsMetadataUpdateInBulkRequestBody.md) + - [ProductsMetadataUpdateInBulkResponseBody](docs/ProductsMetadataUpdateInBulkResponseBody.md) + - [ProductsSkusCreateRequestBody](docs/ProductsSkusCreateRequestBody.md) + - [ProductsSkusCreateResponseBody](docs/ProductsSkusCreateResponseBody.md) + - [ProductsSkusListResponseBody](docs/ProductsSkusListResponseBody.md) + - [ProductsSkusUpdateRequestBody](docs/ProductsSkusUpdateRequestBody.md) + - [ProductsSkusUpdateResponseBody](docs/ProductsSkusUpdateResponseBody.md) + - [ProductsUpdateInBulkRequestBody](docs/ProductsUpdateInBulkRequestBody.md) + - [ProductsUpdateInBulkResponseBody](docs/ProductsUpdateInBulkResponseBody.md) + - [ProductsUpdateRequestBody](docs/ProductsUpdateRequestBody.md) + - [ProductsUpdateResponseBody](docs/ProductsUpdateResponseBody.md) + - [PromotionStack](docs/PromotionStack.md) + - [PromotionStackBase](docs/PromotionStackBase.md) + - [PromotionStackBaseTiers](docs/PromotionStackBaseTiers.md) + - [PromotionStackTiers](docs/PromotionStackTiers.md) + - [PromotionTier](docs/PromotionTier.md) + - [PromotionTierAction](docs/PromotionTierAction.md) + - [PromotionTierCampaign](docs/PromotionTierCampaign.md) + - [PromotionTierCreateParams](docs/PromotionTierCreateParams.md) + - [PromotionTierCreateParamsAction](docs/PromotionTierCreateParamsAction.md) + - [PromotionTierSummary](docs/PromotionTierSummary.md) + - [PromotionTierSummaryOrders](docs/PromotionTierSummaryOrders.md) + - [PromotionTierSummaryRedemptions](docs/PromotionTierSummaryRedemptions.md) + - [PromotionTiersList](docs/PromotionTiersList.md) + - [PromotionsStacksCreateRequestBody](docs/PromotionsStacksCreateRequestBody.md) + - [PromotionsStacksCreateRequestBodyTiers](docs/PromotionsStacksCreateRequestBodyTiers.md) + - [PromotionsStacksCreateResponseBody](docs/PromotionsStacksCreateResponseBody.md) + - [PromotionsStacksCreateResponseBodyTiers](docs/PromotionsStacksCreateResponseBodyTiers.md) + - [PromotionsStacksGetResponseBody](docs/PromotionsStacksGetResponseBody.md) + - [PromotionsStacksGetResponseBodyTiers](docs/PromotionsStacksGetResponseBodyTiers.md) + - [PromotionsStacksListResponseBody](docs/PromotionsStacksListResponseBody.md) + - [PromotionsStacksUpdateRequestBody](docs/PromotionsStacksUpdateRequestBody.md) + - [PromotionsStacksUpdateRequestBodyTiers](docs/PromotionsStacksUpdateRequestBodyTiers.md) + - [PromotionsStacksUpdateResponseBody](docs/PromotionsStacksUpdateResponseBody.md) + - [PromotionsStacksUpdateResponseBodyTiers](docs/PromotionsStacksUpdateResponseBodyTiers.md) + - [PromotionsTiersCreateRequestBody](docs/PromotionsTiersCreateRequestBody.md) + - [PromotionsTiersCreateRequestBodyAction](docs/PromotionsTiersCreateRequestBodyAction.md) + - [PromotionsTiersCreateResponseBody](docs/PromotionsTiersCreateResponseBody.md) + - [PromotionsTiersCreateResponseBodyAction](docs/PromotionsTiersCreateResponseBodyAction.md) + - [PromotionsTiersCreateResponseBodyCampaign](docs/PromotionsTiersCreateResponseBodyCampaign.md) + - [PromotionsTiersCreateResponseBodySummary](docs/PromotionsTiersCreateResponseBodySummary.md) + - [PromotionsTiersCreateResponseBodySummaryOrders](docs/PromotionsTiersCreateResponseBodySummaryOrders.md) + - [PromotionsTiersCreateResponseBodySummaryRedemptions](docs/PromotionsTiersCreateResponseBodySummaryRedemptions.md) + - [PromotionsTiersDisableResponseBody](docs/PromotionsTiersDisableResponseBody.md) + - [PromotionsTiersDisableResponseBodyAction](docs/PromotionsTiersDisableResponseBodyAction.md) + - [PromotionsTiersDisableResponseBodyCampaign](docs/PromotionsTiersDisableResponseBodyCampaign.md) + - [PromotionsTiersDisableResponseBodySummary](docs/PromotionsTiersDisableResponseBodySummary.md) + - [PromotionsTiersDisableResponseBodySummaryOrders](docs/PromotionsTiersDisableResponseBodySummaryOrders.md) + - [PromotionsTiersDisableResponseBodySummaryRedemptions](docs/PromotionsTiersDisableResponseBodySummaryRedemptions.md) + - [PromotionsTiersEnableResponseBody](docs/PromotionsTiersEnableResponseBody.md) + - [PromotionsTiersEnableResponseBodyAction](docs/PromotionsTiersEnableResponseBodyAction.md) + - [PromotionsTiersEnableResponseBodyCampaign](docs/PromotionsTiersEnableResponseBodyCampaign.md) + - [PromotionsTiersEnableResponseBodySummary](docs/PromotionsTiersEnableResponseBodySummary.md) + - [PromotionsTiersEnableResponseBodySummaryOrders](docs/PromotionsTiersEnableResponseBodySummaryOrders.md) + - [PromotionsTiersEnableResponseBodySummaryRedemptions](docs/PromotionsTiersEnableResponseBodySummaryRedemptions.md) + - [PromotionsTiersGetResponseBody](docs/PromotionsTiersGetResponseBody.md) + - [PromotionsTiersGetResponseBodyAction](docs/PromotionsTiersGetResponseBodyAction.md) + - [PromotionsTiersGetResponseBodyCampaign](docs/PromotionsTiersGetResponseBodyCampaign.md) + - [PromotionsTiersGetResponseBodySummary](docs/PromotionsTiersGetResponseBodySummary.md) + - [PromotionsTiersGetResponseBodySummaryOrders](docs/PromotionsTiersGetResponseBodySummaryOrders.md) + - [PromotionsTiersGetResponseBodySummaryRedemptions](docs/PromotionsTiersGetResponseBodySummaryRedemptions.md) + - [PromotionsTiersListResponseBody](docs/PromotionsTiersListResponseBody.md) + - [PromotionsTiersUpdateRequestBody](docs/PromotionsTiersUpdateRequestBody.md) + - [PromotionsTiersUpdateRequestBodyAction](docs/PromotionsTiersUpdateRequestBodyAction.md) + - [PromotionsTiersUpdateResponseBody](docs/PromotionsTiersUpdateResponseBody.md) + - [PromotionsTiersUpdateResponseBodyAction](docs/PromotionsTiersUpdateResponseBodyAction.md) + - [PromotionsTiersUpdateResponseBodyCampaign](docs/PromotionsTiersUpdateResponseBodyCampaign.md) + - [PromotionsTiersUpdateResponseBodySummary](docs/PromotionsTiersUpdateResponseBodySummary.md) + - [PromotionsTiersUpdateResponseBodySummaryOrders](docs/PromotionsTiersUpdateResponseBodySummaryOrders.md) + - [PromotionsTiersUpdateResponseBodySummaryRedemptions](docs/PromotionsTiersUpdateResponseBodySummaryRedemptions.md) + - [PublicationsCreateRequestBody](docs/PublicationsCreateRequestBody.md) + - [PublicationsCreateRequestBodyCustomer](docs/PublicationsCreateRequestBodyCustomer.md) + - [PublicationsCreateRequestBodyCustomerAddress](docs/PublicationsCreateRequestBodyCustomerAddress.md) + - [PublicationsCreateResponseBody](docs/PublicationsCreateResponseBody.md) + - [PublicationsListResponseBody](docs/PublicationsListResponseBody.md) + - [PublicationsListResponseBodyPublicationsItem](docs/PublicationsListResponseBodyPublicationsItem.md) + - [PublicationsListResponseBodyPublicationsItemMetadata](docs/PublicationsListResponseBodyPublicationsItemMetadata.md) + - [QualificationsCheckEligibilityRequestBody](docs/QualificationsCheckEligibilityRequestBody.md) + - [QualificationsCheckEligibilityResponseBody](docs/QualificationsCheckEligibilityResponseBody.md) + - [QualificationsFieldConditions](docs/QualificationsFieldConditions.md) + - [QualificationsFiltersCondition](docs/QualificationsFiltersCondition.md) + - [QualificationsOption](docs/QualificationsOption.md) + - [QualificationsOptionFilters](docs/QualificationsOptionFilters.md) + - [QualificationsOptionFiltersCampaignType](docs/QualificationsOptionFiltersCampaignType.md) + - [QualificationsOptionFiltersCampaignTypeConditions](docs/QualificationsOptionFiltersCampaignTypeConditions.md) + - [QualificationsOptionFiltersHolderRole](docs/QualificationsOptionFiltersHolderRole.md) + - [QualificationsOptionFiltersHolderRoleConditions](docs/QualificationsOptionFiltersHolderRoleConditions.md) + - [QualificationsOptionFiltersResourceType](docs/QualificationsOptionFiltersResourceType.md) + - [QualificationsOptionFiltersResourceTypeConditions](docs/QualificationsOptionFiltersResourceTypeConditions.md) + - [QualificationsRedeemable](docs/QualificationsRedeemable.md) + - [QualificationsRedeemableBase](docs/QualificationsRedeemableBase.md) + - [QualificationsRedeemables](docs/QualificationsRedeemables.md) + - [RedeemableGift](docs/RedeemableGift.md) + - [RedeemableLoyaltyCard](docs/RedeemableLoyaltyCard.md) + - [RedeemableResult](docs/RedeemableResult.md) + - [RedeemableVoucher](docs/RedeemableVoucher.md) + - [RedeemableVoucherGift](docs/RedeemableVoucherGift.md) + - [RedeemableVoucherLoyaltyCard](docs/RedeemableVoucherLoyaltyCard.md) + - [RedeemableVoucherPublish](docs/RedeemableVoucherPublish.md) + - [RedeemableVoucherRedemption](docs/RedeemableVoucherRedemption.md) + - [Redemption](docs/Redemption.md) + - [RedemptionChannel](docs/RedemptionChannel.md) + - [RedemptionEntry](docs/RedemptionEntry.md) + - [RedemptionEntryChannel](docs/RedemptionEntryChannel.md) + - [RedemptionEntryCustomer](docs/RedemptionEntryCustomer.md) + - [RedemptionEntryGift](docs/RedemptionEntryGift.md) + - [RedemptionEntryLoyaltyCard](docs/RedemptionEntryLoyaltyCard.md) + - [RedemptionEntryOrder](docs/RedemptionEntryOrder.md) + - [RedemptionEntryOrderCustomer](docs/RedemptionEntryOrderCustomer.md) + - [RedemptionEntryOrderReferrer](docs/RedemptionEntryOrderReferrer.md) + - [RedemptionEntryPromotionTier](docs/RedemptionEntryPromotionTier.md) + - [RedemptionEntryPromotionTierAction](docs/RedemptionEntryPromotionTierAction.md) + - [RedemptionEntryPromotionTierCampaign](docs/RedemptionEntryPromotionTierCampaign.md) + - [RedemptionEntryPromotionTierSummary](docs/RedemptionEntryPromotionTierSummary.md) + - [RedemptionEntryPromotionTierSummaryOrders](docs/RedemptionEntryPromotionTierSummaryOrders.md) + - [RedemptionEntryPromotionTierSummaryRedemptions](docs/RedemptionEntryPromotionTierSummaryRedemptions.md) + - [RedemptionEntryRelatedRedemptions](docs/RedemptionEntryRelatedRedemptions.md) + - [RedemptionEntryRelatedRedemptionsRedemptionsItem](docs/RedemptionEntryRelatedRedemptionsRedemptionsItem.md) + - [RedemptionEntryRelatedRedemptionsRollbacksItem](docs/RedemptionEntryRelatedRedemptionsRollbacksItem.md) + - [RedemptionEntryVoucher](docs/RedemptionEntryVoucher.md) + - [RedemptionEntryVoucherGift](docs/RedemptionEntryVoucherGift.md) + - [RedemptionEntryVoucherLoyaltyCard](docs/RedemptionEntryVoucherLoyaltyCard.md) + - [RedemptionEntryVoucherPublish](docs/RedemptionEntryVoucherPublish.md) + - [RedemptionEntryVoucherRedemption](docs/RedemptionEntryVoucherRedemption.md) + - [RedemptionGift](docs/RedemptionGift.md) + - [RedemptionLoyaltyCard](docs/RedemptionLoyaltyCard.md) + - [RedemptionRelatedRedemptions](docs/RedemptionRelatedRedemptions.md) + - [RedemptionRelatedRedemptionsRedemptionsItem](docs/RedemptionRelatedRedemptionsRedemptionsItem.md) + - [RedemptionRelatedRedemptionsRollbacksItem](docs/RedemptionRelatedRedemptionsRollbacksItem.md) + - [RedemptionRewardResult](docs/RedemptionRewardResult.md) + - [RedemptionRewardResultParameters](docs/RedemptionRewardResultParameters.md) + - [RedemptionRewardResultParametersCampaign](docs/RedemptionRewardResultParametersCampaign.md) + - [RedemptionRewardResultParametersCoin](docs/RedemptionRewardResultParametersCoin.md) + - [RedemptionRewardResultParametersProduct](docs/RedemptionRewardResultParametersProduct.md) + - [RedemptionRollback](docs/RedemptionRollback.md) + - [RedemptionRollbackChannel](docs/RedemptionRollbackChannel.md) + - [RedemptionRollbackGift](docs/RedemptionRollbackGift.md) + - [RedemptionRollbackLoyaltyCard](docs/RedemptionRollbackLoyaltyCard.md) + - [RedemptionRollbackRelatedRedemptions](docs/RedemptionRollbackRelatedRedemptions.md) + - [RedemptionRollbackRelatedRedemptionsRedemptionsItem](docs/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md) + - [RedemptionRollbackRelatedRedemptionsRollbacksItem](docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md) + - [RedemptionVoucher](docs/RedemptionVoucher.md) + - [RedemptionVoucherGift](docs/RedemptionVoucherGift.md) + - [RedemptionVoucherLoyaltyCard](docs/RedemptionVoucherLoyaltyCard.md) + - [RedemptionVoucherPublish](docs/RedemptionVoucherPublish.md) + - [RedemptionVoucherRedemption](docs/RedemptionVoucherRedemption.md) + - [RedemptionsGetResponseBody](docs/RedemptionsGetResponseBody.md) + - [RedemptionsGetResponseBodyChannel](docs/RedemptionsGetResponseBodyChannel.md) + - [RedemptionsGetResponseBodyCustomer](docs/RedemptionsGetResponseBodyCustomer.md) + - [RedemptionsGetResponseBodyGift](docs/RedemptionsGetResponseBodyGift.md) + - [RedemptionsGetResponseBodyLoyaltyCard](docs/RedemptionsGetResponseBodyLoyaltyCard.md) + - [RedemptionsGetResponseBodyOrder](docs/RedemptionsGetResponseBodyOrder.md) + - [RedemptionsGetResponseBodyOrderCustomer](docs/RedemptionsGetResponseBodyOrderCustomer.md) + - [RedemptionsGetResponseBodyOrderReferrer](docs/RedemptionsGetResponseBodyOrderReferrer.md) + - [RedemptionsGetResponseBodyPromotionTier](docs/RedemptionsGetResponseBodyPromotionTier.md) + - [RedemptionsGetResponseBodyPromotionTierAction](docs/RedemptionsGetResponseBodyPromotionTierAction.md) + - [RedemptionsGetResponseBodyPromotionTierCampaign](docs/RedemptionsGetResponseBodyPromotionTierCampaign.md) + - [RedemptionsGetResponseBodyPromotionTierSummary](docs/RedemptionsGetResponseBodyPromotionTierSummary.md) + - [RedemptionsGetResponseBodyPromotionTierSummaryOrders](docs/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md) + - [RedemptionsGetResponseBodyPromotionTierSummaryRedemptions](docs/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md) + - [RedemptionsGetResponseBodyRelatedRedemptions](docs/RedemptionsGetResponseBodyRelatedRedemptions.md) + - [RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem](docs/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md) + - [RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem](docs/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md) + - [RedemptionsGetResponseBodyVoucher](docs/RedemptionsGetResponseBodyVoucher.md) + - [RedemptionsGetResponseBodyVoucherGift](docs/RedemptionsGetResponseBodyVoucherGift.md) + - [RedemptionsGetResponseBodyVoucherLoyaltyCard](docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md) + - [RedemptionsGetResponseBodyVoucherPublish](docs/RedemptionsGetResponseBodyVoucherPublish.md) + - [RedemptionsGetResponseBodyVoucherRedemption](docs/RedemptionsGetResponseBodyVoucherRedemption.md) + - [RedemptionsListResponseBody](docs/RedemptionsListResponseBody.md) + - [RedemptionsListResponseBodyRedemptionsItem](docs/RedemptionsListResponseBodyRedemptionsItem.md) + - [RedemptionsListResponseBodyRedemptionsItemChannel](docs/RedemptionsListResponseBodyRedemptionsItemChannel.md) + - [RedemptionsListResponseBodyRedemptionsItemCustomer](docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md) + - [RedemptionsListResponseBodyRedemptionsItemGift](docs/RedemptionsListResponseBodyRedemptionsItemGift.md) + - [RedemptionsListResponseBodyRedemptionsItemLoyaltyCard](docs/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md) + - [RedemptionsListResponseBodyRedemptionsItemOrder](docs/RedemptionsListResponseBodyRedemptionsItemOrder.md) + - [RedemptionsListResponseBodyRedemptionsItemOrderCustomer](docs/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md) + - [RedemptionsListResponseBodyRedemptionsItemOrderReferrer](docs/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md) + - [RedemptionsListResponseBodyRedemptionsItemPromotionTier](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md) + - [RedemptionsListResponseBodyRedemptionsItemPromotionTierAction](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md) + - [RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md) + - [RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md) + - [RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md) + - [RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions](docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md) + - [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions](docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md) + - [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem](docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md) + - [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem](docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md) + - [RedemptionsListResponseBodyRedemptionsItemVoucher](docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md) + - [RedemptionsListResponseBodyRedemptionsItemVoucherGift](docs/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md) + - [RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard](docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md) + - [RedemptionsListResponseBodyRedemptionsItemVoucherPublish](docs/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md) + - [RedemptionsListResponseBodyRedemptionsItemVoucherRedemption](docs/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md) + - [RedemptionsRedeemRequestBody](docs/RedemptionsRedeemRequestBody.md) + - [RedemptionsRedeemRequestBodyOptions](docs/RedemptionsRedeemRequestBodyOptions.md) + - [RedemptionsRedeemRequestBodyRedeemablesItem](docs/RedemptionsRedeemRequestBodyRedeemablesItem.md) + - [RedemptionsRedeemRequestBodyRedeemablesItemGift](docs/RedemptionsRedeemRequestBodyRedeemablesItemGift.md) + - [RedemptionsRedeemRequestBodyRedeemablesItemReward](docs/RedemptionsRedeemRequestBodyRedeemablesItemReward.md) + - [RedemptionsRedeemResponseBody](docs/RedemptionsRedeemResponseBody.md) + - [RedemptionsRollbackCreateRequestBody](docs/RedemptionsRollbackCreateRequestBody.md) + - [RedemptionsRollbackCreateResponseBody](docs/RedemptionsRollbackCreateResponseBody.md) + - [RedemptionsRollbackCreateResponseBodyChannel](docs/RedemptionsRollbackCreateResponseBodyChannel.md) + - [RedemptionsRollbackCreateResponseBodyGift](docs/RedemptionsRollbackCreateResponseBodyGift.md) + - [RedemptionsRollbackCreateResponseBodyLoyaltyCard](docs/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md) + - [RedemptionsRollbackCreateResponseBodyRelatedRedemptions](docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md) + - [RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem](docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md) + - [RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem](docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md) + - [RedemptionsRollbacksCreateRequestBody](docs/RedemptionsRollbacksCreateRequestBody.md) + - [RedemptionsRollbacksCreateResponseBody](docs/RedemptionsRollbacksCreateResponseBody.md) + - [ReferralProgram](docs/ReferralProgram.md) + - [ReferralProgramCustomEvent](docs/ReferralProgramCustomEvent.md) + - [ReferralProgramRefereeReward](docs/ReferralProgramRefereeReward.md) + - [ReferralProgramRefereeRewardRelatedObjectParent](docs/ReferralProgramRefereeRewardRelatedObjectParent.md) + - [Referrer](docs/Referrer.md) + - [ReferrerAddress](docs/ReferrerAddress.md) + - [ReferrerId](docs/ReferrerId.md) + - [ResourceTypes](docs/ResourceTypes.md) + - [Reward](docs/Reward.md) + - [RewardAssignment](docs/RewardAssignment.md) + - [RewardAssignmentParameters](docs/RewardAssignmentParameters.md) + - [RewardAssignmentParametersLoyalty](docs/RewardAssignmentParametersLoyalty.md) + - [RewardAttributes](docs/RewardAttributes.md) + - [RewardType](docs/RewardType.md) + - [RewardTypeCampaign](docs/RewardTypeCampaign.md) + - [RewardTypeCoin](docs/RewardTypeCoin.md) + - [RewardTypeProduct](docs/RewardTypeProduct.md) + - [RewardsAssignmentsCreateRequestBody](docs/RewardsAssignmentsCreateRequestBody.md) + - [RewardsAssignmentsCreateRequestBodyParameters](docs/RewardsAssignmentsCreateRequestBodyParameters.md) + - [RewardsAssignmentsCreateRequestBodyParametersLoyalty](docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md) + - [RewardsAssignmentsCreateResponseBody](docs/RewardsAssignmentsCreateResponseBody.md) + - [RewardsAssignmentsCreateResponseBodyParameters](docs/RewardsAssignmentsCreateResponseBodyParameters.md) + - [RewardsAssignmentsCreateResponseBodyParametersLoyalty](docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md) + - [RewardsAssignmentsGetResponseBody](docs/RewardsAssignmentsGetResponseBody.md) + - [RewardsAssignmentsGetResponseBodyParameters](docs/RewardsAssignmentsGetResponseBodyParameters.md) + - [RewardsAssignmentsGetResponseBodyParametersLoyalty](docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md) + - [RewardsAssignmentsListResponseBody](docs/RewardsAssignmentsListResponseBody.md) + - [RewardsAssignmentsUpdateRequestBody](docs/RewardsAssignmentsUpdateRequestBody.md) + - [RewardsAssignmentsUpdateRequestBodyParameters](docs/RewardsAssignmentsUpdateRequestBodyParameters.md) + - [RewardsAssignmentsUpdateRequestBodyParametersLoyalty](docs/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md) + - [RewardsAssignmentsUpdateResponseBody](docs/RewardsAssignmentsUpdateResponseBody.md) + - [RewardsAssignmentsUpdateResponseBodyParameters](docs/RewardsAssignmentsUpdateResponseBodyParameters.md) + - [RewardsAssignmentsUpdateResponseBodyParametersLoyalty](docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md) + - [RewardsCreateRequestBody](docs/RewardsCreateRequestBody.md) + - [RewardsCreateRequestBodyAttributes](docs/RewardsCreateRequestBodyAttributes.md) + - [RewardsCreateRequestBodyParameters](docs/RewardsCreateRequestBodyParameters.md) + - [RewardsCreateRequestBodyParametersCampaign](docs/RewardsCreateRequestBodyParametersCampaign.md) + - [RewardsCreateRequestBodyParametersCoin](docs/RewardsCreateRequestBodyParametersCoin.md) + - [RewardsCreateRequestBodyParametersProduct](docs/RewardsCreateRequestBodyParametersProduct.md) + - [RewardsCreateResponseBody](docs/RewardsCreateResponseBody.md) + - [RewardsCreateResponseBodyAttributes](docs/RewardsCreateResponseBodyAttributes.md) + - [RewardsListResponseBody](docs/RewardsListResponseBody.md) + - [RewardsUpdateRequestBody](docs/RewardsUpdateRequestBody.md) + - [RewardsUpdateRequestBodyAttributes](docs/RewardsUpdateRequestBodyAttributes.md) + - [RewardsUpdateRequestBodyParameters](docs/RewardsUpdateRequestBodyParameters.md) + - [RewardsUpdateRequestBodyParametersCampaign](docs/RewardsUpdateRequestBodyParametersCampaign.md) + - [RewardsUpdateRequestBodyParametersCoin](docs/RewardsUpdateRequestBodyParametersCoin.md) + - [RewardsUpdateRequestBodyParametersProduct](docs/RewardsUpdateRequestBodyParametersProduct.md) + - [RewardsUpdateResponseBody](docs/RewardsUpdateResponseBody.md) + - [RewardsUpdateResponseBodyAttributes](docs/RewardsUpdateResponseBodyAttributes.md) + - [SegmentsCreateRequestBody](docs/SegmentsCreateRequestBody.md) + - [SegmentsCreateResponseBody](docs/SegmentsCreateResponseBody.md) + - [SegmentsGetResponseBody](docs/SegmentsGetResponseBody.md) + - [Session](docs/Session.md) + - [SimpleCustomer](docs/SimpleCustomer.md) + - [SimpleCustomerRequiredObjectType](docs/SimpleCustomerRequiredObjectType.md) + - [SimpleLoyaltyCard](docs/SimpleLoyaltyCard.md) + - [SimpleProductDiscountUnit](docs/SimpleProductDiscountUnit.md) + - [SimpleSegment](docs/SimpleSegment.md) + - [SimpleSkuDiscountUnit](docs/SimpleSkuDiscountUnit.md) + - [SimpleVoucher](docs/SimpleVoucher.md) + - [SimpleVoucherRedemption](docs/SimpleVoucherRedemption.md) + - [Sku](docs/Sku.md) + - [SkusGetResponseBody](docs/SkusGetResponseBody.md) + - [SkusImportCsvCreateResponseBody](docs/SkusImportCsvCreateResponseBody.md) + - [SkusListForProduct](docs/SkusListForProduct.md) + - [StackingRules](docs/StackingRules.md) + - [ValidationRule](docs/ValidationRule.md) + - [ValidationRuleApplicableTo](docs/ValidationRuleApplicableTo.md) + - [ValidationRuleAssignment](docs/ValidationRuleAssignment.md) + - [ValidationRuleAssignmentsList](docs/ValidationRuleAssignmentsList.md) + - [ValidationRuleError](docs/ValidationRuleError.md) + - [ValidationRulesAssignmentsCreateRequestBody](docs/ValidationRulesAssignmentsCreateRequestBody.md) + - [ValidationRulesAssignmentsCreateResponseBody](docs/ValidationRulesAssignmentsCreateResponseBody.md) + - [ValidationRulesAssignmentsList](docs/ValidationRulesAssignmentsList.md) + - [ValidationRulesAssignmentsListResponseBody](docs/ValidationRulesAssignmentsListResponseBody.md) + - [ValidationRulesCreateRequestBody](docs/ValidationRulesCreateRequestBody.md) + - [ValidationRulesCreateRequestBodyApplicableTo](docs/ValidationRulesCreateRequestBodyApplicableTo.md) + - [ValidationRulesCreateRequestBodyError](docs/ValidationRulesCreateRequestBodyError.md) + - [ValidationRulesCreateResponseBody](docs/ValidationRulesCreateResponseBody.md) + - [ValidationRulesCreateResponseBodyApplicableTo](docs/ValidationRulesCreateResponseBodyApplicableTo.md) + - [ValidationRulesCreateResponseBodyError](docs/ValidationRulesCreateResponseBodyError.md) + - [ValidationRulesGetResponseBody](docs/ValidationRulesGetResponseBody.md) + - [ValidationRulesGetResponseBodyApplicableTo](docs/ValidationRulesGetResponseBodyApplicableTo.md) + - [ValidationRulesGetResponseBodyError](docs/ValidationRulesGetResponseBodyError.md) + - [ValidationRulesListResponseBody](docs/ValidationRulesListResponseBody.md) + - [ValidationRulesUpdateRequestBody](docs/ValidationRulesUpdateRequestBody.md) + - [ValidationRulesUpdateRequestBodyApplicableTo](docs/ValidationRulesUpdateRequestBodyApplicableTo.md) + - [ValidationRulesUpdateRequestBodyError](docs/ValidationRulesUpdateRequestBodyError.md) + - [ValidationRulesUpdateResponseBody](docs/ValidationRulesUpdateResponseBody.md) + - [ValidationRulesUpdateResponseBodyApplicableTo](docs/ValidationRulesUpdateResponseBodyApplicableTo.md) + - [ValidationRulesUpdateResponseBodyError](docs/ValidationRulesUpdateResponseBodyError.md) + - [ValidationsRedeemableInapplicable](docs/ValidationsRedeemableInapplicable.md) + - [ValidationsRedeemableInapplicableResult](docs/ValidationsRedeemableInapplicableResult.md) + - [ValidationsRedeemableInapplicableResultDetails](docs/ValidationsRedeemableInapplicableResultDetails.md) + - [ValidationsRedeemableSkipped](docs/ValidationsRedeemableSkipped.md) + - [ValidationsRedeemableSkippedResult](docs/ValidationsRedeemableSkippedResult.md) + - [ValidationsRedeemableSkippedResultDetails](docs/ValidationsRedeemableSkippedResultDetails.md) + - [ValidationsValidateRequestBody](docs/ValidationsValidateRequestBody.md) + - [ValidationsValidateRequestBodyOptions](docs/ValidationsValidateRequestBodyOptions.md) + - [ValidationsValidateRequestBodyRedeemablesItem](docs/ValidationsValidateRequestBodyRedeemablesItem.md) + - [ValidationsValidateRequestBodyRedeemablesItemGift](docs/ValidationsValidateRequestBodyRedeemablesItemGift.md) + - [ValidationsValidateRequestBodyRedeemablesItemReward](docs/ValidationsValidateRequestBodyRedeemablesItemReward.md) + - [ValidationsValidateResponseBody](docs/ValidationsValidateResponseBody.md) + - [ValidationsValidateResponseBodyRedeemablesItem](docs/ValidationsValidateResponseBodyRedeemablesItem.md) + - [ValidationsValidateResponseBodyRedeemablesItemResult](docs/ValidationsValidateResponseBodyRedeemablesItemResult.md) + - [ValidationsValidateResponseBodyRedeemablesItemResultDetails](docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md) + - [ValidationsValidateResponseBodyRedeemablesItemResultDiscount](docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) + - [ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct](docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) + - [ValidationsValidateResponseBodyRedeemablesItemResultGift](docs/ValidationsValidateResponseBodyRedeemablesItemResultGift.md) + - [ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard](docs/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) + - [ValidityHours](docs/ValidityHours.md) + - [ValidityHoursDailyItem](docs/ValidityHoursDailyItem.md) + - [ValidityTimeframe](docs/ValidityTimeframe.md) + - [Voucher](docs/Voucher.md) + - [VoucherAssets](docs/VoucherAssets.md) + - [VoucherAssetsBarcode](docs/VoucherAssetsBarcode.md) + - [VoucherAssetsQr](docs/VoucherAssetsQr.md) + - [VoucherGift](docs/VoucherGift.md) + - [VoucherLoyaltyCard](docs/VoucherLoyaltyCard.md) + - [VoucherPublish](docs/VoucherPublish.md) + - [VoucherRedemption](docs/VoucherRedemption.md) + - [VoucherTransaction](docs/VoucherTransaction.md) + - [VoucherTransactionDetails](docs/VoucherTransactionDetails.md) + - [VoucherTransactionDetailsBalance](docs/VoucherTransactionDetailsBalance.md) + - [VoucherTransactionDetailsBalanceRelatedObject](docs/VoucherTransactionDetailsBalanceRelatedObject.md) + - [VoucherTransactionDetailsCustomEvent](docs/VoucherTransactionDetailsCustomEvent.md) + - [VoucherTransactionDetailsEarningRule](docs/VoucherTransactionDetailsEarningRule.md) + - [VoucherTransactionDetailsEarningRuleSource](docs/VoucherTransactionDetailsEarningRuleSource.md) + - [VoucherTransactionDetailsEvent](docs/VoucherTransactionDetailsEvent.md) + - [VoucherTransactionDetailsEventSchema](docs/VoucherTransactionDetailsEventSchema.md) + - [VoucherTransactionDetailsLoyaltyTier](docs/VoucherTransactionDetailsLoyaltyTier.md) + - [VoucherTransactionDetailsOrder](docs/VoucherTransactionDetailsOrder.md) + - [VoucherTransactionDetailsRedemption](docs/VoucherTransactionDetailsRedemption.md) + - [VoucherTransactionDetailsReward](docs/VoucherTransactionDetailsReward.md) + - [VoucherTransactionDetailsRollback](docs/VoucherTransactionDetailsRollback.md) + - [VoucherTransactionDetailsSegment](docs/VoucherTransactionDetailsSegment.md) + - [VoucherTransactionsExportFilterConditions](docs/VoucherTransactionsExportFilterConditions.md) + - [VoucherTransactionsExportFilterConditionsVoucherId](docs/VoucherTransactionsExportFilterConditionsVoucherId.md) + - [VoucherTransactionsExportFilterConditionsVoucherIdConditions](docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md) + - [VoucherTransactionsExportParameters](docs/VoucherTransactionsExportParameters.md) + - [VoucherTransactionsFilters](docs/VoucherTransactionsFilters.md) + - [VoucherWithCategories](docs/VoucherWithCategories.md) + - [VoucherWithCategoriesGift](docs/VoucherWithCategoriesGift.md) + - [VoucherWithCategoriesLoyaltyCard](docs/VoucherWithCategoriesLoyaltyCard.md) + - [VoucherWithCategoriesPublish](docs/VoucherWithCategoriesPublish.md) + - [VoucherWithCategoriesRedemption](docs/VoucherWithCategoriesRedemption.md) + - [VouchersBalanceUpdateRequestBody](docs/VouchersBalanceUpdateRequestBody.md) + - [VouchersBalanceUpdateResponseBody](docs/VouchersBalanceUpdateResponseBody.md) + - [VouchersBalanceUpdateResponseBodyRelatedObject](docs/VouchersBalanceUpdateResponseBodyRelatedObject.md) + - [VouchersCreateResponseBody](docs/VouchersCreateResponseBody.md) + - [VouchersCreateResponseBodyGift](docs/VouchersCreateResponseBodyGift.md) + - [VouchersCreateResponseBodyLoyaltyCard](docs/VouchersCreateResponseBodyLoyaltyCard.md) + - [VouchersCreateResponseBodyPublish](docs/VouchersCreateResponseBodyPublish.md) + - [VouchersCreateResponseBodyRedemption](docs/VouchersCreateResponseBodyRedemption.md) + - [VouchersCreateWithSpecificCodeRequestBody](docs/VouchersCreateWithSpecificCodeRequestBody.md) + - [VouchersCreateWithSpecificCodeRequestBodyRedemption](docs/VouchersCreateWithSpecificCodeRequestBodyRedemption.md) + - [VouchersDisableResponseBody](docs/VouchersDisableResponseBody.md) + - [VouchersDisableResponseBodyGift](docs/VouchersDisableResponseBodyGift.md) + - [VouchersDisableResponseBodyLoyaltyCard](docs/VouchersDisableResponseBodyLoyaltyCard.md) + - [VouchersDisableResponseBodyPublish](docs/VouchersDisableResponseBodyPublish.md) + - [VouchersDisableResponseBodyRedemption](docs/VouchersDisableResponseBodyRedemption.md) + - [VouchersEnableResponseBody](docs/VouchersEnableResponseBody.md) + - [VouchersEnableResponseBodyGift](docs/VouchersEnableResponseBodyGift.md) + - [VouchersEnableResponseBodyLoyaltyCard](docs/VouchersEnableResponseBodyLoyaltyCard.md) + - [VouchersEnableResponseBodyPublish](docs/VouchersEnableResponseBodyPublish.md) + - [VouchersEnableResponseBodyRedemption](docs/VouchersEnableResponseBodyRedemption.md) + - [VouchersGetResponseBody](docs/VouchersGetResponseBody.md) + - [VouchersGetResponseBodyGift](docs/VouchersGetResponseBodyGift.md) + - [VouchersGetResponseBodyLoyaltyCard](docs/VouchersGetResponseBodyLoyaltyCard.md) + - [VouchersGetResponseBodyPublish](docs/VouchersGetResponseBodyPublish.md) + - [VouchersGetResponseBodyRedemption](docs/VouchersGetResponseBodyRedemption.md) + - [VouchersImportCreateItemRequestBody](docs/VouchersImportCreateItemRequestBody.md) + - [VouchersImportCreateItemRequestBodyRedemption](docs/VouchersImportCreateItemRequestBodyRedemption.md) + - [VouchersImportCreateResponseBody](docs/VouchersImportCreateResponseBody.md) + - [VouchersImportCsvCreateResponseBody](docs/VouchersImportCsvCreateResponseBody.md) + - [VouchersListResponseBody](docs/VouchersListResponseBody.md) + - [VouchersMetadataUpdateInBulkRequestBody](docs/VouchersMetadataUpdateInBulkRequestBody.md) + - [VouchersMetadataUpdateInBulkResponseBody](docs/VouchersMetadataUpdateInBulkResponseBody.md) + - [VouchersRedemptionGetResponseBody](docs/VouchersRedemptionGetResponseBody.md) + - [VouchersTransactionsExportCreateRequestBody](docs/VouchersTransactionsExportCreateRequestBody.md) + - [VouchersTransactionsExportCreateResponseBody](docs/VouchersTransactionsExportCreateResponseBody.md) + - [VouchersTransactionsExportCreateResponseBodyResult](docs/VouchersTransactionsExportCreateResponseBodyResult.md) + - [VouchersTransactionsListResponseBody](docs/VouchersTransactionsListResponseBody.md) + - [VouchersUpdateInBulkItemRequestBody](docs/VouchersUpdateInBulkItemRequestBody.md) + - [VouchersUpdateInBulkResponseBody](docs/VouchersUpdateInBulkResponseBody.md) + - [VouchersUpdateRequestBody](docs/VouchersUpdateRequestBody.md) + - [VouchersUpdateResponseBody](docs/VouchersUpdateResponseBody.md) + - [VouchersUpdateResponseBodyGift](docs/VouchersUpdateResponseBodyGift.md) + - [VouchersUpdateResponseBodyLoyaltyCard](docs/VouchersUpdateResponseBodyLoyaltyCard.md) + - [VouchersUpdateResponseBodyPublish](docs/VouchersUpdateResponseBodyPublish.md) + - [VouchersUpdateResponseBodyRedemption](docs/VouchersUpdateResponseBodyRedemption.md) + + + +## Documentation For Authorization + + +Authentication schemes defined for the API: + +### X-App-Id + +- **Type**: API key +- **API key parameter name**: X-App-Id +- **Location**: HTTP header + + +### X-App-Token + +- **Type**: API key +- **API key parameter name**: X-App-Token +- **Location**: HTTP header + + +### X-Client-Token + +- **Type**: API key +- **API key parameter name**: X-Client-Token +- **Location**: HTTP header + + +### X-Client-Application-Id + +- **Type**: API key +- **API key parameter name**: X-Client-Application-Id +- **Location**: HTTP header + + +## Author + +support@voucherify.io -```python -from voucherify import utils -``` -#### Available methods - -- `utils.calculate_price(base_price, voucher, unit_price)` -- `utils.calculate_discount(base_price, voucher, unit_price)` - ---- - -## Contributing - -Bug reports and pull requests are welcome through [GitHub Issues](https://github.com/voucherifyio/voucherify-python-sdk/issues). - -## Changelog - -- **2022-04-06** - `2.2.2` - - Added `client.vouchers.releaseValidationSession` method - - Added `client.redemptions.redeemStackable` method - - Added `client.validations.validateStackable` method -- **2021-05-26** - `2.2.1` - - Upload new version to pypi.org. No changes compared to `2.2.0` -- **2021-05-20** - `2.2.0` - - Added `client.validations*` member - - Added method `validateVoucher` to `client.validations` - - Changed default timeout from 500 minutes to 3 minutes. Made timeout configurable - - Bugfix: Fixed raising exception when response json contains property "error" -- **2019-06-19** - `2.1.0` Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region. -- **2018-01-20** - `2.0.0` - - Moved vouchers related methods to `client.vouchers.*` namespace - - Moved redemptions related methods to `client.redemptions.*` namespace - - Moved distributions related methods to `client.distributions.*` namespace - - Renamed `client.customer.*` to `client.customers.*` - - Removed outdated `client.distributions.publish(campaignName)` method interface - - Fixed utils methods to accept vouchers with `None` gift -- **2016-12-02** - `1.4.2` - Support gift vouchers in utils -- **2016-10-04** - `1.4.1` - Publish update -- **2016-07-18** - `1.4.0` - Voucher code pattern -- **2016-07-18** - `1.3.0` - Update voucher -- **2016-06-23** - `1.2.1` - Gift vouchers -- **2016-06-16** - `1.2.0` - Unified naming convention -- **2016-06-16** - `1.1.0` - Added customer methods -- **2016-06-08** - `1.0.0` - Release version -- **2016-05-31** - `0.1.0` - First version: - - Authentication - - Voucher informations: *get*, *usage* - - Voucher operations: *use* - - Utils - -[Create Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-voucher -[Get Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#vouchers-get -[Update Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-voucher -[List Vouchers]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-vouchers -[Enable Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#enable-voucher -[Disable Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#disable-voucher -[Release Validation Session]: https://docs.voucherify.io/reference/release-validation-session - -[Publish Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-publication - -[Validate Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#validate-voucher -[Validate Stackable]: https://docs.voucherify.io/reference/validate-stacked-discounts-1 - -[Redeem Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#redeem-voucher -[Redeem Stackable]: https://docs.voucherify.io/reference/redeem-stacked-discounts -[List Redemptions]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-redemptions -[Get Voucher's Redemptions]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#vouchers-redemptions -[Rollback Redemption]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#rollback-redemption - -[Create Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-customer -[Get Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#read-customer -[Update Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-customer -[Delete Customer]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-customer diff --git a/__tests__/main.py b/__tests__/main.py new file mode 100644 index 00000000..893caf76 --- /dev/null +++ b/__tests__/main.py @@ -0,0 +1,9 @@ +import unittest + + +loader = unittest.TestLoader() +suite = loader.discover(start_dir='./__tests__/', pattern='test_*.py') +runner = unittest.TextTestRunner() + +if __name__ == "__main__": + runner.run(suite) diff --git a/__tests__/products_voucherify.csv b/__tests__/products_voucherify.csv new file mode 100644 index 00000000..70f1bf02 --- /dev/null +++ b/__tests__/products_voucherify.csv @@ -0,0 +1,2 @@ +name,source_id,price,attributes,image_url,Fashion +T-Shirt,productSourceID11,21,"color,size,ranking",https://images.com/original.jpg,slim \ No newline at end of file diff --git a/__tests__/spec_utils.py b/__tests__/spec_utils.py new file mode 100644 index 00000000..6d32cac8 --- /dev/null +++ b/__tests__/spec_utils.py @@ -0,0 +1,27 @@ +import os +import voucherify as voucherifyClient +from dotenv import load_dotenv + +load_dotenv() + +HOST = os.getenv('VOUCHERIFY_HOST', 'https://api.voucherify.io') +X_APP_ID = os.getenv('X_APP_ID') +X_APP_TOKEN = os.getenv('X_APP_TOKEN') + +if not X_APP_ID or not X_APP_TOKEN: + raise ValueError("X_APP_ID and X_APP_TOKEN must be set in the .env file.") + +configuration = voucherifyClient.Configuration( + host=HOST, + api_key={ + "X-App-Id": X_APP_ID, + "X-App-Token": X_APP_TOKEN + } +) +# Debugging line +api_key_id = configuration.get_api_key_with_prefix('X-App-Id') +api_key_token = configuration.get_api_key_with_prefix('X-App-Token') + +# Print whether both API keys are present and valid +are_keys_present = bool(api_key_id) and bool(api_key_token) +print(f"Configuration loaded: {are_keys_present}") diff --git a/__tests__/test_01_validation.py b/__tests__/test_01_validation.py new file mode 100644 index 00000000..58f96542 --- /dev/null +++ b/__tests__/test_01_validation.py @@ -0,0 +1,102 @@ +import sys +import os +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) + +import spec_utils +import unittest +import responses +import voucherify as voucherifyClient +from pprint import pprint +import random +import spec_utils +import time + +random_code = random.randint(0, 10000000) +voucher_code = "test_code_" + str(random_code) +campaign_name = "test_campaign_" + str(random_code) +customer_source_id = "test_customer_" + str(random_code) + +class TestYourSDK(unittest.TestCase): + def __init__(self, *args, **kwargs): + super(TestYourSDK, self).__init__(*args, **kwargs) + + @responses.activate + def test_01_add_vouchers_to_campaign(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.CampaignsApi(api_client) + + try: + campaigns_create_request_body = voucherifyClient.CampaignsCreateRequestBody( + name=campaign_name, + voucher=voucherifyClient.CampaignsCreateRequestBodyVoucher( + type="DISCOUNT_VOUCHER", + discount=voucherifyClient.Discount( + type="AMOUNT", + amount_off=1000 + ) + ), + metadata={ + "mandatory_v": "test" + } + ) + campaign = api_instance.create_campaign(campaigns_create_request_body) + + async_action_id = api_instance.add_vouchers_to_campaign(campaign.id, vouchers_count=5).async_action_id + campaigns_vouchers_create_response_body = api_instance.add_vouchers_to_campaign(campaign.id) + campaigns_vouchers_specific_code_create_response_body = api_instance.add_voucher_with_specific_code_to_campaign(campaign.id, voucher_code) + + self.assertIsNotNone(async_action_id) + self.assertIsNotNone(campaigns_vouchers_create_response_body) + self.assertIsNotNone(campaigns_vouchers_specific_code_create_response_body) + + except voucherifyClient.ApiException as e: + self.fail(e) + + @responses.activate + def test_02_create_customer(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.CustomersApi(api_client) + + try: + result = api_instance.create_customer(voucherifyClient.CustomersCreateRequestBody( + source_id=customer_source_id + )) + self.assertIsNotNone(result) + + except voucherifyClient.ApiException as e: + self.fail(e) + + @responses.activate + def test_03_validate_stacked_discounts(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.ValidationsApi(api_client) + + try: + validations_validate_request_body = voucherifyClient.ValidationsValidateRequestBody( + redeemables=[voucherifyClient.ValidationsValidateRequestBodyRedeemablesItem( + id=voucher_code, + object='voucher' + )], + customer=voucherifyClient.Customer( + source_id=customer_source_id + ), + order=voucherifyClient.Order( + amount=30000, + metadata={ + "key_customer": "test" + } + ), + metadata={ + "key": "value" + } + ) + result = api_instance.validate_stacked_discounts(validations_validate_request_body) + self.assertIsNotNone(result) + self.assertEqual(result.valid, True) + + except voucherifyClient.ApiException as e: + self.fail(e) + + +if __name__ == '__main__': + unittest.main() diff --git a/__tests__/test_02_redemption.py b/__tests__/test_02_redemption.py new file mode 100644 index 00000000..6487ab6f --- /dev/null +++ b/__tests__/test_02_redemption.py @@ -0,0 +1,129 @@ +import sys +import os +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) + +import unittest +import responses +import voucherify as voucherifyClient +import spec_utils +from pprint import pprint +import random +import time + +random_code = random.randint(0, 10000000) +voucher_code = "test_code_" + str(random_code) +campaign_name = "test_campaign_" + str(random_code) +customer_source_id = "test_customer_" + str(random_code) +redemption_id = None +customer_metadata = { + "key_customer": "test" +} + +class TestYourSDK(unittest.TestCase): + def __init__(self, *args, **kwargs): + super(TestYourSDK, self).__init__(*args, **kwargs) + + @responses.activate + def test_01_add_vouchers_to_campaign(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.CampaignsApi(api_client) + + try: + campaigns_create_request_body = voucherifyClient.CampaignsCreateRequestBody( + name=campaign_name, + voucher=voucherifyClient.CampaignsCreateRequestBodyVoucher( + type="DISCOUNT_VOUCHER", + discount=voucherifyClient.Discount( + type="AMOUNT", + amount_off=1000 + ) + ), + metadata={ + "mandatory_v": "test" + } + ) + campaign = api_instance.create_campaign(campaigns_create_request_body) + + async_action = api_instance.add_vouchers_to_campaign(campaign.id, 5) + campaigns_vouchers_create_response_body = api_instance.add_vouchers_to_campaign(campaign.id) + campaigns_vouchers_specific_code_create_response_body = api_instance.add_voucher_with_specific_code_to_campaign(campaign.id, voucher_code) + + self.assertIsNotNone(async_action) + self.assertIsNotNone(campaigns_vouchers_create_response_body) + self.assertIsNotNone(campaigns_vouchers_specific_code_create_response_body) + + except voucherifyClient.ApiException as e: + self.fail(e) + + @responses.activate + def test_02_redeem_stacked_discounts(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.RedemptionsApi(api_client) + + try: + redemptions_redeem_request_body = voucherifyClient.RedemptionsRedeemRequestBody( + redeemables=[voucherifyClient.RedemptionsRedeemRequestBodyRedeemablesItem( + id=voucher_code, + object='voucher' + )], + customer=voucherifyClient.Customer( + source_id=customer_source_id, + metadata=customer_metadata + ), + order=voucherifyClient.Order( + amount=30000, + metadata={ + "key_customer": "test" + } + ), + metadata={ + "key": "value" + } + ) + result = api_instance.redeem_stacked_discounts(redemptions_redeem_request_body) + self.assertIsNotNone(result) + self.assertEqual(result.redemptions[0].result, 'SUCCESS') + + except voucherifyClient.ApiException as e: + self.fail(e) + + @responses.activate + def test_03_get_customer(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.CustomersApi(api_client) + + try: + time.sleep(1) + result = api_instance.get_customer(customer_source_id) + self.assertIsNotNone(result) + self.assertEqual(result.metadata, customer_metadata) + + except voucherifyClient.ApiException as e: + self.fail(e) + + @responses.activate + def test_04_list_redemptions(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.RedemptionsApi(api_client) + # OBJECTS IN QUERY ARE NOT YET SUPPORTED !! + # + # list_redemptions_filters = voucherifyClient.ParameterFiltersListRedemptions( + # voucher_code=voucherifyClient.ParameterFiltersListRedemptionsVoucherCode( + # conditions=voucherifyClient.FilterConditionsString( + # var_is=voucher_code + # ) + # ) + # ) + try: + result = api_instance.list_redemptions( + 100, + None,None,None,None,None,None, + # list_redemptions_filters + ) + self.assertEqual(result.object, 'list') + except voucherifyClient.ApiException as e: + self.fail(e) + + +if __name__ == '__main__': + unittest.main() diff --git a/__tests__/test_03_qualifications.py b/__tests__/test_03_qualifications.py new file mode 100644 index 00000000..2f82aada --- /dev/null +++ b/__tests__/test_03_qualifications.py @@ -0,0 +1,71 @@ +import sys +import os +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) + +import spec_utils +import unittest +import responses +import voucherify as voucherifyClient +from pprint import pprint +import random +import spec_utils +import time + +voucher_code=None + +class TestYourSDK(unittest.TestCase): + @classmethod + @responses.activate + def setUpClass(cls): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.QualificationsApi(api_client) + + qualifications_check_eligibility_request_body = voucherifyClient.QualificationsCheckEligibilityRequestBody( + scenario='ALL', + options=voucherifyClient.QualificationsOption( + filters=voucherifyClient.QualificationsOptionFilters( + resource_type=voucherifyClient.QualificationsOptionFiltersResourceType( + conditions=voucherifyClient.QualificationsOptionFiltersResourceTypeConditions( + var_in=['voucher'] + ) + ) + ) + ) + ) + qualifications = api_instance.check_eligibility(qualifications_check_eligibility_request_body) + cls.voucher_code = qualifications.redeemables.data[0].id + + @responses.activate + def test_01_check_if_voucher_code_was_returned(self): + self.assertIsNotNone(self.voucher_code) + + @responses.activate + def test_02_validate_stacked_discounts(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.ValidationsApi(api_client) + + try: + validations_validate_request_body = voucherifyClient.ValidationsValidateRequestBody( + redeemables=[voucherifyClient.ValidationsValidateRequestBodyRedeemablesItem( + id=self.voucher_code, + object='voucher' + )], + order=voucherifyClient.Order( + amount=30000, + metadata={ + "key_customer": "test" + } + ), + metadata={ + "key": "value" + } + ) + result = api_instance.validate_stacked_discounts(validations_validate_request_body) + self.assertIsNotNone(result) + self.assertEqual(result.valid, True) + + except voucherifyClient.ApiException as e: + self.fail(e) + +if __name__ == '__main__': + unittest.main() diff --git a/__tests__/test_04_publications.py b/__tests__/test_04_publications.py new file mode 100644 index 00000000..7bf04a5d --- /dev/null +++ b/__tests__/test_04_publications.py @@ -0,0 +1,57 @@ +import sys +import os +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) + +import spec_utils +import unittest +import responses +import voucherify as voucherifyClient +from pprint import pprint +import random +import spec_utils +import time + +voucher_code=None +random_code = random.randint(0, 10000000) +email = "voucherify+" + str(random_code) + "@example.com" +campaign_name = "test_campaign_" + str(random_code) + +class TestYourSDK(unittest.TestCase): + def __init__(self, *args, **kwargs): + super(TestYourSDK, self).__init__(*args, **kwargs) + + @responses.activate + def test_01_test_publications(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + campaigns_api_instance = voucherifyClient.CampaignsApi(api_client) + publications_api_instance = voucherifyClient.PublicationsApi(api_client) + + campaigns_create_request_body = voucherifyClient.CampaignsCreateRequestBody( + name=campaign_name, + type='AUTO_UPDATE', + voucher=voucherifyClient.CampaignsCreateRequestBodyVoucher( + type="DISCOUNT_VOUCHER", + discount=voucherifyClient.Discount( + type="AMOUNT", + amount_off=1000 + ) + ), + metadata={ + "mandatory_v": "test" + } + ) + campaigns_api_instance.create_campaign(campaigns_create_request_body) + publication = publications_api_instance.create_publication( + True, + voucherifyClient.PublicationsCreateRequestBody( + campaign=voucherifyClient.CreatePublicationCampaign(name=campaign_name), + customer=voucherifyClient.PublicationsCreateRequestBodyCustomer( + email=email + ) + ) + ) + self.assertIsNotNone(publication.id) + + +if __name__ == '__main__': + unittest.main() diff --git a/__tests__/test_05_products.py b/__tests__/test_05_products.py new file mode 100644 index 00000000..0730fda6 --- /dev/null +++ b/__tests__/test_05_products.py @@ -0,0 +1,39 @@ +import sys +import os +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) + +import spec_utils +import unittest +import responses +import voucherify as voucherifyClient +from pprint import pprint +import random +import spec_utils +import time + +random_code = random.randint(0, 10000000) +voucher_code = "test_code_" + str(random_code) +campaign_name = "test_campaign_" + str(random_code) +customer_source_id = "test_customer_" + str(random_code) + +class TestYourSDK(unittest.TestCase): + def __init__(self, *args, **kwargs): + super(TestYourSDK, self).__init__(*args, **kwargs) + + @responses.activate + def test_01_import_products(self): + with voucherifyClient.ApiClient(spec_utils.configuration) as api_client: + api_instance = voucherifyClient.ProductsApi(api_client) + + try: + file_path = os.path.join(os.path.dirname(__file__), './products_voucherify.csv') + result = api_instance.import_products_using_csv(file_path) + + self.assertIsNotNone(result.async_action_id) + + except voucherifyClient.ApiException as e: + self.fail(e) + + +if __name__ == '__main__': + unittest.main() diff --git a/docs/AccessSettingsCampaignAssignmentsList.md b/docs/AccessSettingsCampaignAssignmentsList.md new file mode 100644 index 00000000..9dcd13e8 --- /dev/null +++ b/docs/AccessSettingsCampaignAssignmentsList.md @@ -0,0 +1,16 @@ +# AccessSettingsCampaignAssignmentsList + +Lists all assignments of the campaign to areas and stores if the Areas and Stores feature is enabled (Enterprise feature). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. Default is `list`. This object stores information about campaign assignments to areas and stores | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of campaign assignments. | [optional] [default to 'data'] +**data** | [**List[AreaStoreCampaignAssignment]**](AreaStoreCampaignAssignment.md) | Contains an array of campaign assignments. | [optional] +**total** | **int** | Total number of areas and stores to which the campaign is assigned. | [optional] + +[[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/ApplicableTo.md b/docs/ApplicableTo.md new file mode 100644 index 00000000..e9756d92 --- /dev/null +++ b/docs/ApplicableTo.md @@ -0,0 +1,28 @@ +# ApplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | This object stores information about the resource to which the discount is applicable. | [optional] +**id** | **str** | Unique product collection, product, or SKU identifier assigned by Voucherify. | [optional] +**source_id** | **str** | The source identifier from your inventory system. | [optional] +**product_id** | **str** | Parent product's unique ID assigned by Voucherify. | [optional] +**product_source_id** | **str** | Parent product's source ID from your inventory system. | [optional] +**strict** | **bool** | | [optional] +**price** | **float** | New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. | [optional] +**price_formula** | **float** | Formula used to calculate the discounted price of an item. | [optional] +**effect** | [**ApplicableToEffect**](ApplicableToEffect.md) | | +**quantity_limit** | **int** | The maximum number of units allowed to be discounted per order line item. | [optional] +**aggregated_quantity_limit** | **int** | The maximum number of units allowed to be discounted combined across all matched order line items. | [optional] +**amount_limit** | **int** | Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**aggregated_amount_limit** | **int** | Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value) | [optional] +**order_item_indices** | **List[int]** | Determines the order in which the discount is applied to the products or SKUs sent in the `order` object in the request. The counting begins from `0`. | [optional] +**repeat** | **int** | Determines the recurrence of the discount, e.g. `\"repeat\": 3` means that the discount is applied to every third item. | [optional] +**skip_initially** | **int** | Determines how many items are skipped before the discount is applied. | [optional] +**target** | **str** | Determines to which kinds of objects the discount is applicable. `\"ITEM\"` includes products and SKUs. | [optional] + +[[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/ApplicableToEffect.md b/docs/ApplicableToEffect.md new file mode 100644 index 00000000..f139aa12 --- /dev/null +++ b/docs/ApplicableToEffect.md @@ -0,0 +1,18 @@ +# ApplicableToEffect + + +## Enum + +* `APPLY_TO_EVERY` (value: `'APPLY_TO_EVERY'`) + +* `APPLY_TO_CHEAPEST` (value: `'APPLY_TO_CHEAPEST'`) + +* `APPLY_FROM_CHEAPEST` (value: `'APPLY_FROM_CHEAPEST'`) + +* `APPLY_TO_MOST_EXPENSIVE` (value: `'APPLY_TO_MOST_EXPENSIVE'`) + +* `APPLY_FROM_MOST_EXPENSIVE` (value: `'APPLY_FROM_MOST_EXPENSIVE'`) + +[[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/ApplicableToResultList.md b/docs/ApplicableToResultList.md new file mode 100644 index 00000000..2099cacb --- /dev/null +++ b/docs/ApplicableToResultList.md @@ -0,0 +1,15 @@ +# ApplicableToResultList + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**List[ApplicableTo]**](ApplicableTo.md) | Contains array of items to which the discount can apply. | [optional] +**total** | **int** | Total number of objects defining included products, SKUs, or product collections. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'list'] +**data_ref** | **str** | The type of the object represented by JSON. | [optional] [default to 'data'] + +[[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/AreaStoreCampaignAssignment.md b/docs/AreaStoreCampaignAssignment.md new file mode 100644 index 00000000..f28de000 --- /dev/null +++ b/docs/AreaStoreCampaignAssignment.md @@ -0,0 +1,17 @@ +# AreaStoreCampaignAssignment + +An object representing an assignment of a campaign to an area or store. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the campaign assignment. | [optional] +**area_id** | **str** | Unique identifier of the area to which the campaign is assigned. | [optional] +**area_store_id** | **str** | Unique identifier of the store to which the campaign is assigned. | [optional] +**created_at** | **datetime** | Date and time when the assignment was made. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign assignment to areas or stores. | [optional] [default to 'area_store_campaign_assignment'] + +[[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/AsyncActionBase.md b/docs/AsyncActionBase.md new file mode 100644 index 00000000..c18f9beb --- /dev/null +++ b/docs/AsyncActionBase.md @@ -0,0 +1,22 @@ +# AsyncActionBase + +This is an object representing an asynchronous action. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Async action unique ID. | [optional] +**type** | **str** | Type of async action. | [optional] +**status** | **str** | Status of the async action. Informs you whether the async action has already been completed. | [optional] +**operation_status** | **str** | Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. | [optional] +**request_id** | **str** | Unique request ID. | [optional] +**processing_time** | **int** | The length of time it took to process the request in milliseconds. | [optional] +**progress** | **int** | % progress to completion of the asynchronous action. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the `async_action`. | [optional] [default to 'async_action'] + +[[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/AsyncActionGetResponseBody.md b/docs/AsyncActionGetResponseBody.md new file mode 100644 index 00000000..cc0b73d1 --- /dev/null +++ b/docs/AsyncActionGetResponseBody.md @@ -0,0 +1,23 @@ +# AsyncActionGetResponseBody + +Response body schema for **GET** `v1/async-actions/{asyncActionId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Async action unique ID. | [optional] +**type** | **str** | Type of async action. | [optional] +**status** | **str** | Status of the async action. Informs you whether the async action has already been completed. | [optional] +**operation_status** | **str** | Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the async action was scheduled in ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format. | [optional] +**request_id** | **str** | Unique request ID. | [optional] +**processing_time** | **int** | The length of time it took to process the request in milliseconds. | [optional] +**progress** | **int** | % progress to completion of the asynchronous action. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the `async_action`. | [optional] [default to 'async_action'] +**result** | **object** | | [optional] + +[[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/AsyncActionsApi.md b/docs/AsyncActionsApi.md new file mode 100644 index 00000000..b9293f20 --- /dev/null +++ b/docs/AsyncActionsApi.md @@ -0,0 +1,184 @@ +# voucherify.AsyncActionsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_async_action**](AsyncActionsApi.md#get_async_action) | **GET** /v1/async-actions/{asyncActionId} | Get Async Action +[**list_async_actions**](AsyncActionsApi.md#list_async_actions) | **GET** /v1/async-actions | List Async Actions + + +# **get_async_action** +> AsyncActionGetResponseBody get_async_action(async_action_id) + +Get Async Action + +Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.async_action_get_response_body import AsyncActionGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.AsyncActionsApi(api_client) + async_action_id = 'async_action_id_example' # str | Unique ID of the asynchronous operation. + + try: + # Get Async Action + api_response = api_instance.get_async_action(async_action_id) + print("The response of AsyncActionsApi->get_async_action:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AsyncActionsApi->get_async_action: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **async_action_id** | **str**| Unique ID of the asynchronous operation. | + +### Return type + +[**AsyncActionGetResponseBody**](AsyncActionGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns detailed information about the async action result. | - | + +[[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) + +# **list_async_actions** +> AsyncActionsListResponseBody list_async_actions(limit=limit, end_date=end_date) + +List Async Actions + +Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.async_actions_list_response_body import AsyncActionsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.AsyncActionsApi(api_client) + limit = 56 # int | Limit the number of asynchronous actions that the API returns in the response. (optional) + end_date = '2013-10-20T19:20:30+01:00' # datetime | Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). (optional) + + try: + # List Async Actions + api_response = api_instance.list_async_actions(limit=limit, end_date=end_date) + print("The response of AsyncActionsApi->list_async_actions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AsyncActionsApi->list_async_actions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limit the number of asynchronous actions that the API returns in the response. | [optional] + **end_date** | **datetime**| Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). | [optional] + +### Return type + +[**AsyncActionsListResponseBody**](AsyncActionsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of all scheduled asynchronous actions and detailed information for each scheduled action. Note that a status `DONE`doesn't include the result of the completed action. If you need more information about the result, use the ID of the respective async action to call the <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + diff --git a/docs/AsyncActionsListResponseBody.md b/docs/AsyncActionsListResponseBody.md new file mode 100644 index 00000000..8d809d5f --- /dev/null +++ b/docs/AsyncActionsListResponseBody.md @@ -0,0 +1,15 @@ +# AsyncActionsListResponseBody + +Response body schema for **GET** `v1/async-actions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about asynchronous actions. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of asynchronous actions. | [optional] [default to 'async_actions'] +**async_actions** | [**List[AsyncActionBase]**](AsyncActionBase.md) | | [optional] + +[[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/BusValRuleAssignment.md b/docs/BusValRuleAssignment.md new file mode 100644 index 00000000..1218c9f4 --- /dev/null +++ b/docs/BusValRuleAssignment.md @@ -0,0 +1,21 @@ +# BusValRuleAssignment + +Assignments of business validation rule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique identifier for a assignment | [optional] +**rule_id** | **str** | The unique identifier for a rule | [optional] +**related_object_id** | **str** | The unique identifier for a related object | [optional] +**related_object_type** | **str** | The type of related object | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the object was last updated in ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'validation_rules_assignment'] +**validation_status** | **str** | The validation status of the assignment | [optional] +**validation_omitted_rules** | **List[str]** | The list of omitted rules | [optional] + +[[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/CampaignBase.md b/docs/CampaignBase.md new file mode 100644 index 00000000..a035510a --- /dev/null +++ b/docs/CampaignBase.md @@ -0,0 +1,41 @@ +# CampaignBase + +This is an object representing a campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] + +[[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/CampaignLoyaltyCard.md b/docs/CampaignLoyaltyCard.md new file mode 100644 index 00000000..cbab485a --- /dev/null +++ b/docs/CampaignLoyaltyCard.md @@ -0,0 +1,14 @@ +# CampaignLoyaltyCard + +Schema model for a campaign loyalty card. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card. | [optional] +**expiration_rules** | [**CampaignLoyaltyCardExpirationRules**](CampaignLoyaltyCardExpirationRules.md) | | [optional] + +[[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/CampaignLoyaltyCardExpirationRules.md b/docs/CampaignLoyaltyCardExpirationRules.md new file mode 100644 index 00000000..c74dad87 --- /dev/null +++ b/docs/CampaignLoyaltyCardExpirationRules.md @@ -0,0 +1,15 @@ +# CampaignLoyaltyCardExpirationRules + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**period_type** | **str** | Type of period | [optional] [default to 'MONTH'] +**period_value** | **int** | Value of the period | [optional] +**rounding_type** | **str** | Type of rounding | [optional] +**rounding_value** | **int** | Value of rounding | [optional] + +[[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/CampaignLoyaltyVoucher.md b/docs/CampaignLoyaltyVoucher.md new file mode 100644 index 00000000..cda5836c --- /dev/null +++ b/docs/CampaignLoyaltyVoucher.md @@ -0,0 +1,16 @@ +# CampaignLoyaltyVoucher + +Schema model for a discount voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Type of voucher. | [optional] [default to 'LOYALTY_CARD'] +**loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | +**redemption** | [**CampaignLoyaltyVoucherRedemption**](CampaignLoyaltyVoucherRedemption.md) | | [optional] +**code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] + +[[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/CampaignLoyaltyVoucherRedemption.md b/docs/CampaignLoyaltyVoucherRedemption.md new file mode 100644 index 00000000..2412d912 --- /dev/null +++ b/docs/CampaignLoyaltyVoucherRedemption.md @@ -0,0 +1,13 @@ +# CampaignLoyaltyVoucherRedemption + +Defines the redemption limits on vouchers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/CampaignVoucher.md b/docs/CampaignVoucher.md new file mode 100644 index 00000000..65d062b2 --- /dev/null +++ b/docs/CampaignVoucher.md @@ -0,0 +1,24 @@ +# CampaignVoucher + +Schema model for a campaign voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Type of voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] +**redemption** | [**CampaignVoucherRedemption**](CampaignVoucherRedemption.md) | | [optional] +**code_config** | [**CodeConfig**](CodeConfig.md) | | +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] + +[[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/CampaignVoucherRedemption.md b/docs/CampaignVoucherRedemption.md new file mode 100644 index 00000000..0c090df0 --- /dev/null +++ b/docs/CampaignVoucherRedemption.md @@ -0,0 +1,13 @@ +# CampaignVoucherRedemption + +Defines the redemption limits on vouchers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/CampaignsApi.md b/docs/CampaignsApi.md new file mode 100644 index 00000000..b6c65b03 --- /dev/null +++ b/docs/CampaignsApi.md @@ -0,0 +1,995 @@ +# voucherify.CampaignsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_voucher_with_specific_code_to_campaign**](CampaignsApi.md#add_voucher_with_specific_code_to_campaign) | **POST** /v1/campaigns/{campaignId}/vouchers/{code} | Add Voucher with Specific Code to Campaign +[**add_vouchers_to_campaign**](CampaignsApi.md#add_vouchers_to_campaign) | **POST** /v1/campaigns/{campaignId}/vouchers | Add Vouchers to Campaign +[**create_campaign**](CampaignsApi.md#create_campaign) | **POST** /v1/campaigns | Create Campaign +[**delete_campaign**](CampaignsApi.md#delete_campaign) | **DELETE** /v1/campaigns/{campaignId} | Delete Campaign +[**disable_campaign**](CampaignsApi.md#disable_campaign) | **POST** /v1/campaigns/{campaignId}/disable | Disable Campaign +[**enable_campaign**](CampaignsApi.md#enable_campaign) | **POST** /v1/campaigns/{campaignId}/enable | Enable Campaign +[**get_campaign**](CampaignsApi.md#get_campaign) | **GET** /v1/campaigns/{campaignId} | Get Campaign +[**import_vouchers_to_campaign**](CampaignsApi.md#import_vouchers_to_campaign) | **POST** /v1/campaigns/{campaignId}/import | Import Vouchers to Campaign +[**import_vouchers_to_campaign_using_csv**](CampaignsApi.md#import_vouchers_to_campaign_using_csv) | **POST** /v1/campaigns/{campaignId}/importCSV | Import Vouchers to Campaign by CSV +[**list_campaigns**](CampaignsApi.md#list_campaigns) | **GET** /v1/campaigns | List Campaigns +[**update_campaign**](CampaignsApi.md#update_campaign) | **PUT** /v1/campaigns/{campaignId} | Update Campaign + + +# **add_voucher_with_specific_code_to_campaign** +> CampaignsVouchersCreateResponseBody add_voucher_with_specific_code_to_campaign(campaign_id, code, campaigns_vouchers_create_request_body=campaigns_vouchers_create_request_body) + +Add Voucher with Specific Code to Campaign + +This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_vouchers_create_request_body import CampaignsVouchersCreateRequestBody +from voucherify.models.campaigns_vouchers_create_response_body import CampaignsVouchersCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + code = 'code_example' # str | A custom **code** that identifies the voucher. + campaigns_vouchers_create_request_body = {"category_id":"cat_0bb81a481615a37b5e","start_date":"2022-09-24T00:00:00Z","expiration_date":"2022-09-25T23:59:59Z","active":false,"redemption":{"quantity":null},"additional_info":"Voucher added using API","metadata":{"Season":"Fall"}} # CampaignsVouchersCreateRequestBody | Specify the voucher parameters that you would like to overwrite. (optional) + + try: + # Add Voucher with Specific Code to Campaign + api_response = api_instance.add_voucher_with_specific_code_to_campaign(campaign_id, code, campaigns_vouchers_create_request_body=campaigns_vouchers_create_request_body) + print("The response of CampaignsApi->add_voucher_with_specific_code_to_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->add_voucher_with_specific_code_to_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | + **code** | **str**| A custom **code** that identifies the voucher. | + **campaigns_vouchers_create_request_body** | [**CampaignsVouchersCreateRequestBody**](CampaignsVouchersCreateRequestBody.md)| Specify the voucher parameters that you would like to overwrite. | [optional] + +### Return type + +[**CampaignsVouchersCreateResponseBody**](CampaignsVouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a voucher object if the call succeeded. | - | + +[[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) + +# **add_vouchers_to_campaign** +> CampaignsVouchersCreateCombinedResponseBody add_vouchers_to_campaign(campaign_id, vouchers_count=vouchers_count, campaigns_vouchers_create_in_bulk_request_body=campaigns_vouchers_create_in_bulk_request_body) + +Add Vouchers to Campaign + +This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional code_config parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_vouchers_create_combined_response_body import CampaignsVouchersCreateCombinedResponseBody +from voucherify.models.campaigns_vouchers_create_in_bulk_request_body import CampaignsVouchersCreateInBulkRequestBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + vouchers_count = 56 # int | Number of vouchers that should be added. (optional) + campaigns_vouchers_create_in_bulk_request_body = voucherify.CampaignsVouchersCreateInBulkRequestBody() # CampaignsVouchersCreateInBulkRequestBody | Specify the voucher parameters that you would like to overwrite. (optional) + + try: + # Add Vouchers to Campaign + api_response = api_instance.add_vouchers_to_campaign(campaign_id, vouchers_count=vouchers_count, campaigns_vouchers_create_in_bulk_request_body=campaigns_vouchers_create_in_bulk_request_body) + print("The response of CampaignsApi->add_vouchers_to_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->add_vouchers_to_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | + **vouchers_count** | **int**| Number of vouchers that should be added. | [optional] + **campaigns_vouchers_create_in_bulk_request_body** | [**CampaignsVouchersCreateInBulkRequestBody**](CampaignsVouchersCreateInBulkRequestBody.md)| Specify the voucher parameters that you would like to overwrite. | [optional] + +### Return type + +[**CampaignsVouchersCreateCombinedResponseBody**](CampaignsVouchersCreateCombinedResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a voucher object if the call succeeded for a voucher count of 1. and Returns an `async_action_id` if the request was made to create more than 1 voucher. | - | + +[[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) + +# **create_campaign** +> CampaignsCreateResponseBody create_campaign(campaigns_create_request_body=campaigns_create_request_body) + +Create Campaign + +Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. ๐Ÿ“˜ Global uniqueness All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. ๐Ÿšง Code generation status This is an asynchronous action; you cant read or modify a newly created campaign until the code generation is completed. See the creation_status field in the campaign object description. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_create_request_body import CampaignsCreateRequestBody +from voucherify.models.campaigns_create_response_body import CampaignsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaigns_create_request_body = {"name":"Discount Campaign 4","campaign_type":"DISCOUNT_COUPONS","join_once":true,"type":"AUTO_UPDATE","category_id":"cat_0bb343dee3cdb5ec0c","start_date":"2020-08-16T00:00:00Z","expiration_date":"2023-12-26T00:00:00Z","vouchers_count":3,"voucher":{"type":"DISCOUNT_VOUCHER","discount":{"percent_off":10,"type":"PERCENT"},"redemption":{"quantity":10},"code_config":{"pattern":"10OFF-#######"}},"validity_timeframe":{"interval":"P2D","duration":"P1D"},"validity_day_of_week":[0,1,2],"activity_duration_after_publishing":"P24D","use_voucher_metadata_schema":false,"metadata":{"region":"AMER"}} # CampaignsCreateRequestBody | Specify the details of the campaign that you would like to create. (optional) + + try: + # Create Campaign + api_response = api_instance.create_campaign(campaigns_create_request_body=campaigns_create_request_body) + print("The response of CampaignsApi->create_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->create_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaigns_create_request_body** | [**CampaignsCreateRequestBody**](CampaignsCreateRequestBody.md)| Specify the details of the campaign that you would like to create. | [optional] + +### Return type + +[**CampaignsCreateResponseBody**](CampaignsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a campaign object if the call succeeded. | - | + +[[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) + +# **delete_campaign** +> CampaignsDeleteResponseBody delete_campaign(campaign_id, force=force) + +Delete Campaign + +Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_delete_response_body import CampaignsDeleteResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + force = True # bool | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. (optional) + + try: + # Delete Campaign + api_response = api_instance.delete_campaign(campaign_id, force=force) + print("The response of CampaignsApi->delete_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->delete_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | + **force** | **bool**| If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. | [optional] + +### Return type + +[**CampaignsDeleteResponseBody**](CampaignsDeleteResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **disable_campaign** +> object disable_campaign(campaign_id) + +Disable Campaign + +There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + + try: + # Disable Campaign + api_response = api_instance.disable_campaign(campaign_id) + print("The response of CampaignsApi->disable_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->disable_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | + +### Return type + +**object** + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an empty json `{}`. | - | + +[[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) + +# **enable_campaign** +> object enable_campaign(campaign_id) + +Enable Campaign + +There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. + + try: + # Enable Campaign + api_response = api_instance.enable_campaign(campaign_id) + print("The response of CampaignsApi->enable_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->enable_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. | + +### Return type + +**object** + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an empty json `{}`. | - | + +[[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) + +# **get_campaign** +> CampaignsGetResponseBody get_campaign(campaign_id) + +Get Campaign + +Retrieves the campaign with the given campaign ID or campaign name. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_get_response_body import CampaignsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + + try: + # Get Campaign + api_response = api_instance.get_campaign(campaign_id) + print("The response of CampaignsApi->get_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->get_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | + +### Return type + +[**CampaignsGetResponseBody**](CampaignsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a campaign object if a valid identifier was provided. | - | + +[[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) + +# **import_vouchers_to_campaign** +> CampaignsImportCreateResponseBody import_vouchers_to_campaign(campaign_id, campaigns_import_voucher_item=campaigns_import_voucher_item) + +Import Vouchers to Campaign + +Imports vouchers to an **existing** campaign. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_import_create_response_body import CampaignsImportCreateResponseBody +from voucherify.models.campaigns_import_voucher_item import CampaignsImportVoucherItem +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + campaigns_import_voucher_item = [{"code":"CODE7","category":"First","redemption":{"quantity":1},"metadata":{"season":"Fall"},"additional_info":"secret-code1","active":true},{"code":"CODE8","category":"Second","redemption":{"quantity":18},"metadata":{"season":"Fall"},"additional_info":"secret-code1","active":true},{"code":"CODE9","category_id":"cat_0bb343dee3cdb5ec0c","redemption":{"quantity":4},"metadata":{"season":"Fall"},"additional_info":"secret-code1","active":true}] # List[CampaignsImportVoucherItem] | Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. (optional) + + try: + # Import Vouchers to Campaign + api_response = api_instance.import_vouchers_to_campaign(campaign_id, campaigns_import_voucher_item=campaigns_import_voucher_item) + print("The response of CampaignsApi->import_vouchers_to_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->import_vouchers_to_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | + **campaigns_import_voucher_item** | [**List[CampaignsImportVoucherItem]**](CampaignsImportVoucherItem.md)| Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. | [optional] + +### Return type + +[**CampaignsImportCreateResponseBody**](CampaignsImportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported to the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **import_vouchers_to_campaign_using_csv** +> CampaignsImportCsvCreateResponseBody import_vouchers_to_campaign_using_csv(campaign_id, file=file) + +Import Vouchers to Campaign by CSV + +Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_import_csv_create_response_body import CampaignsImportCsvCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. + file = None # bytearray | File path. (optional) + + try: + # Import Vouchers to Campaign by CSV + api_response = api_instance.import_vouchers_to_campaign_using_csv(campaign_id, file=file) + print("The response of CampaignsApi->import_vouchers_to_campaign_using_csv:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->import_vouchers_to_campaign_using_csv: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. | + **file** | **bytearray**| File path. | [optional] + +### Return type + +[**CampaignsImportCsvCreateResponseBody**](CampaignsImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported to the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **list_campaigns** +> CampaignsListResponseBody list_campaigns(limit=limit, page=page, campaign_type=campaign_type, expand=expand, order=order) + +List Campaigns + +Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_list_response_body import CampaignsListResponseBody +from voucherify.models.parameter_campaign_type import ParameterCampaignType +from voucherify.models.parameter_expand_list_campaigns import ParameterExpandListCampaigns +from voucherify.models.parameter_order_list_campaigns import ParameterOrderListCampaigns +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + campaign_type = voucherify.ParameterCampaignType() # ParameterCampaignType | This attribute allows filtering by campaign type. (optional) + expand = category # ParameterExpandListCampaigns | Include an expanded categories object in the response. (optional) (default to category) + order = voucherify.ParameterOrderListCampaigns() # ParameterOrderListCampaigns | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Campaigns + api_response = api_instance.list_campaigns(limit=limit, page=page, campaign_type=campaign_type, expand=expand, order=order) + print("The response of CampaignsApi->list_campaigns:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->list_campaigns: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **campaign_type** | [**ParameterCampaignType**](.md)| This attribute allows filtering by campaign type. | [optional] + **expand** | [**ParameterExpandListCampaigns**](.md)| Include an expanded categories object in the response. | [optional] [default to category] + **order** | [**ParameterOrderListCampaigns**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**CampaignsListResponseBody**](CampaignsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with a `campaign` property that contains an array of campaigns. The maximum number of campaigns returned is determined by the `limit` query parameter. Each entry in the array is a separate campaign object. If no more campaigns are available, the resulting array on a given page will be empty. | - | + +[[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) + +# **update_campaign** +> CampaignsUpdateResponseBody update_campaign(campaign_id, campaigns_update_request_body=campaigns_update_request_body) + +Update Campaign + +Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. ## Vouchers will be affected This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.campaigns_update_request_body import CampaignsUpdateRequestBody +from voucherify.models.campaigns_update_response_body import CampaignsUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CampaignsApi(api_client) + campaign_id = 'campaign_id_example' # str | You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. + campaigns_update_request_body = {"description":"New description"} # CampaignsUpdateRequestBody | Specify the campaign parameters to be updated. (optional) + + try: + # Update Campaign + api_response = api_instance.update_campaign(campaign_id, campaigns_update_request_body=campaigns_update_request_body) + print("The response of CampaignsApi->update_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CampaignsApi->update_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. | + **campaigns_update_request_body** | [**CampaignsUpdateRequestBody**](CampaignsUpdateRequestBody.md)| Specify the campaign parameters to be updated. | [optional] + +### Return type + +[**CampaignsUpdateResponseBody**](CampaignsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the campaign object if the update succeeded. | - | + +[[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) + diff --git a/docs/CampaignsCreateRequestBody.md b/docs/CampaignsCreateRequestBody.md new file mode 100644 index 00000000..f9c059df --- /dev/null +++ b/docs/CampaignsCreateRequestBody.md @@ -0,0 +1,33 @@ +# CampaignsCreateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign (size of campaign). | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**validation_rules** | **List[str]** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**category** | **str** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | | [optional] +**campaign_type** | **str** | | [optional] +**voucher** | [**CampaignsCreateRequestBodyVoucher**](CampaignsCreateRequestBodyVoucher.md) | | [optional] +**referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] +**promotion** | [**CampaignsCreateRequestBodyPromotion**](CampaignsCreateRequestBodyPromotion.md) | | [optional] +**lucky_draw** | [**LuckyDraw**](LuckyDraw.md) | | [optional] + +[[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/CampaignsCreateRequestBodyPromotion.md b/docs/CampaignsCreateRequestBodyPromotion.md new file mode 100644 index 00000000..131bc367 --- /dev/null +++ b/docs/CampaignsCreateRequestBodyPromotion.md @@ -0,0 +1,12 @@ +# CampaignsCreateRequestBodyPromotion + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tiers** | [**List[PromotionTierCreateParams]**](PromotionTierCreateParams.md) | | [optional] + +[[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/CampaignsCreateRequestBodyVoucher.md b/docs/CampaignsCreateRequestBodyVoucher.md new file mode 100644 index 00000000..e6e80cc1 --- /dev/null +++ b/docs/CampaignsCreateRequestBodyVoucher.md @@ -0,0 +1,18 @@ +# CampaignsCreateRequestBodyVoucher + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] +**redemption** | [**CampaignsCreateRequestBodyVoucherRedemption**](CampaignsCreateRequestBodyVoucherRedemption.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] + +[[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/CampaignsCreateRequestBodyVoucherRedemption.md b/docs/CampaignsCreateRequestBodyVoucherRedemption.md new file mode 100644 index 00000000..2d315d67 --- /dev/null +++ b/docs/CampaignsCreateRequestBodyVoucherRedemption.md @@ -0,0 +1,12 @@ +# CampaignsCreateRequestBodyVoucherRedemption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/CampaignsCreateResponseBody.md b/docs/CampaignsCreateResponseBody.md new file mode 100644 index 00000000..9994b6a1 --- /dev/null +++ b/docs/CampaignsCreateResponseBody.md @@ -0,0 +1,44 @@ +# CampaignsCreateResponseBody + +Response body schema for **POST** `v1/campaigns/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**promotion** | [**PromotionTiersList**](PromotionTiersList.md) | | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] + +[[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/CampaignsDeleteResponseBody.md b/docs/CampaignsDeleteResponseBody.md new file mode 100644 index 00000000..70bea74e --- /dev/null +++ b/docs/CampaignsDeleteResponseBody.md @@ -0,0 +1,13 @@ +# CampaignsDeleteResponseBody + +Response body schema for **DELETE** `/campaigns/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/CampaignsGetResponseBody.md b/docs/CampaignsGetResponseBody.md new file mode 100644 index 00000000..7f080b57 --- /dev/null +++ b/docs/CampaignsGetResponseBody.md @@ -0,0 +1,44 @@ +# CampaignsGetResponseBody + +Response body schema for **GET** `v1/campaigns/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**promotion** | [**PromotionTiersList**](PromotionTiersList.md) | | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] + +[[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/CampaignsImportCreateResponseBody.md b/docs/CampaignsImportCreateResponseBody.md new file mode 100644 index 00000000..5a1bc496 --- /dev/null +++ b/docs/CampaignsImportCreateResponseBody.md @@ -0,0 +1,13 @@ +# CampaignsImportCreateResponseBody + +Response body schema for **POST** `v1/campaigns/{campaignId}/import`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/CampaignsImportCsvCreateResponseBody.md b/docs/CampaignsImportCsvCreateResponseBody.md new file mode 100644 index 00000000..53345eda --- /dev/null +++ b/docs/CampaignsImportCsvCreateResponseBody.md @@ -0,0 +1,13 @@ +# CampaignsImportCsvCreateResponseBody + +Response body schema for **POST** `v1/campaigns/{campaignId}/importCSV`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/CampaignsImportVoucherItem.md b/docs/CampaignsImportVoucherItem.md new file mode 100644 index 00000000..1dd6cbc3 --- /dev/null +++ b/docs/CampaignsImportVoucherItem.md @@ -0,0 +1,25 @@ +# CampaignsImportVoucherItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Value representing the imported code. | [optional] +**redemption** | [**CampaignsImportVoucherItemRedemption**](CampaignsImportVoucherItemRedemption.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**metadata** | **object** | | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**start_date** | **datetime** | Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**expiration_date** | **datetime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**type** | **str** | | [optional] +**loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/CampaignsImportVoucherItemRedemption.md b/docs/CampaignsImportVoucherItemRedemption.md new file mode 100644 index 00000000..19434f65 --- /dev/null +++ b/docs/CampaignsImportVoucherItemRedemption.md @@ -0,0 +1,12 @@ +# CampaignsImportVoucherItemRedemption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/CampaignsListResponseBody.md b/docs/CampaignsListResponseBody.md new file mode 100644 index 00000000..bbb38fa6 --- /dev/null +++ b/docs/CampaignsListResponseBody.md @@ -0,0 +1,16 @@ +# CampaignsListResponseBody + +Schema model for **GET** `v1/campaigns`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about campaigns in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of campaign objects. | [optional] [default to 'campaigns'] +**campaigns** | [**List[CampaignBase]**](CampaignBase.md) | Contains array of campaign objects. | [optional] +**total** | **int** | Total number of campaigns. | [optional] + +[[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/CampaignsUpdateRequestBody.md b/docs/CampaignsUpdateRequestBody.md new file mode 100644 index 00000000..e5c8eaf2 --- /dev/null +++ b/docs/CampaignsUpdateRequestBody.md @@ -0,0 +1,33 @@ +# CampaignsUpdateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**category** | **str** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | | [optional] +**unset_metadata_fields** | **List[str]** | Determine which metadata should be removed from campaign. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**discount** | **object** | | [optional] +**referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**options** | [**CampaignsUpdateRequestBodyOptions**](CampaignsUpdateRequestBodyOptions.md) | | [optional] +**winners_count** | **str** | It represents the total number of winners in a lucky draw. | [optional] +**unique_winners_per_draw** | **str** | It indicates whether each winner in a draw is unique or not. | [optional] +**unique_winners** | **str** | Specifies whether each participant can win only once across multiple draws. | [optional] + +[[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/CampaignsUpdateRequestBodyOptions.md b/docs/CampaignsUpdateRequestBodyOptions.md new file mode 100644 index 00000000..3162e46c --- /dev/null +++ b/docs/CampaignsUpdateRequestBodyOptions.md @@ -0,0 +1,12 @@ +# CampaignsUpdateRequestBodyOptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**recalculate_tiers** | **bool** | Determine if tiers should be recalculated or no. | [optional] + +[[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/CampaignsUpdateResponseBody.md b/docs/CampaignsUpdateResponseBody.md new file mode 100644 index 00000000..2964f0d5 --- /dev/null +++ b/docs/CampaignsUpdateResponseBody.md @@ -0,0 +1,44 @@ +# CampaignsUpdateResponseBody + +Response body schema for **PUT** `v1/campaigns/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**CampaignVoucher**](CampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**referral_program** | [**ReferralProgram**](ReferralProgram.md) | | [optional] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**promotion** | [**PromotionTiersList**](PromotionTiersList.md) | | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] + +[[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/CampaignsVouchersCreateCombinedResponseBody.md b/docs/CampaignsVouchersCreateCombinedResponseBody.md new file mode 100644 index 00000000..e60f29c0 --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBody.md @@ -0,0 +1,41 @@ +# CampaignsVouchersCreateCombinedResponseBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**CampaignsVouchersCreateCombinedResponseBodyGift**](CampaignsVouchersCreateCombinedResponseBodyGift.md) | | [optional] +**loyalty_card** | [**CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard**](CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**CampaignsVouchersCreateCombinedResponseBodyPublish**](CampaignsVouchersCreateCombinedResponseBodyPublish.md) | | [optional] +**redemption** | [**CampaignsVouchersCreateCombinedResponseBodyRedemption**](CampaignsVouchersCreateCombinedResponseBodyRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/CampaignsVouchersCreateCombinedResponseBodyGift.md b/docs/CampaignsVouchersCreateCombinedResponseBodyGift.md new file mode 100644 index 00000000..733ed6c9 --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyGift.md @@ -0,0 +1,15 @@ +# CampaignsVouchersCreateCombinedResponseBodyGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md b/docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..7c5f3eb8 --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/CampaignsVouchersCreateCombinedResponseBodyPublish.md b/docs/CampaignsVouchersCreateCombinedResponseBodyPublish.md new file mode 100644 index 00000000..222e2717 --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyPublish.md @@ -0,0 +1,15 @@ +# CampaignsVouchersCreateCombinedResponseBodyPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/CampaignsVouchersCreateCombinedResponseBodyRedemption.md b/docs/CampaignsVouchersCreateCombinedResponseBodyRedemption.md new file mode 100644 index 00000000..899731ab --- /dev/null +++ b/docs/CampaignsVouchersCreateCombinedResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# CampaignsVouchersCreateCombinedResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/CampaignsVouchersCreateInBulkRequestBody.md b/docs/CampaignsVouchersCreateInBulkRequestBody.md new file mode 100644 index 00000000..91d80c19 --- /dev/null +++ b/docs/CampaignsVouchersCreateInBulkRequestBody.md @@ -0,0 +1,20 @@ +# CampaignsVouchersCreateInBulkRequestBody + +Request body schema for **POST** `v1/campaigns/{campaignId}/vouchers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Unique voucher code. | [optional] +**code_config** | [**CodeConfig**](CodeConfig.md) | | [optional] +**category** | **str** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**redemption** | [**CampaignsVouchersCreateInBulkRequestBodyRedemption**](CampaignsVouchersCreateInBulkRequestBodyRedemption.md) | | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] + +[[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/CampaignsVouchersCreateInBulkRequestBodyRedemption.md b/docs/CampaignsVouchersCreateInBulkRequestBodyRedemption.md new file mode 100644 index 00000000..155b8363 --- /dev/null +++ b/docs/CampaignsVouchersCreateInBulkRequestBodyRedemption.md @@ -0,0 +1,13 @@ +# CampaignsVouchersCreateInBulkRequestBodyRedemption + +Stores the quantity of redemptions that can be applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/CampaignsVouchersCreateRequestBody.md b/docs/CampaignsVouchersCreateRequestBody.md new file mode 100644 index 00000000..19bc81de --- /dev/null +++ b/docs/CampaignsVouchersCreateRequestBody.md @@ -0,0 +1,18 @@ +# CampaignsVouchersCreateRequestBody + +Request body schema for **POST** `v1/campaigns/{campaignId}/vouchers/{code}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**redemption** | [**CampaignsVouchersCreateRequestBodyRedemption**](CampaignsVouchersCreateRequestBodyRedemption.md) | | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] + +[[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/CampaignsVouchersCreateRequestBodyRedemption.md b/docs/CampaignsVouchersCreateRequestBodyRedemption.md new file mode 100644 index 00000000..f0057867 --- /dev/null +++ b/docs/CampaignsVouchersCreateRequestBodyRedemption.md @@ -0,0 +1,13 @@ +# CampaignsVouchersCreateRequestBodyRedemption + +Stores the quantity of redemptions that can be applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/CampaignsVouchersCreateResponseBody.md b/docs/CampaignsVouchersCreateResponseBody.md new file mode 100644 index 00000000..d447a079 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBody.md @@ -0,0 +1,41 @@ +# CampaignsVouchersCreateResponseBody + +Response body schema for **POST** `v1/campaigns/{campaignId}/vouchers/{code}` and **POST** `v1/campaigns/{campaignId}/vouchers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**CampaignsVouchersCreateResponseBodyGift**](CampaignsVouchersCreateResponseBodyGift.md) | | [optional] +**loyalty_card** | [**CampaignsVouchersCreateResponseBodyLoyaltyCard**](CampaignsVouchersCreateResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**CampaignsVouchersCreateResponseBodyPublish**](CampaignsVouchersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**CampaignsVouchersCreateResponseBodyRedemption**](CampaignsVouchersCreateResponseBodyRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/CampaignsVouchersCreateResponseBodyGift.md b/docs/CampaignsVouchersCreateResponseBodyGift.md new file mode 100644 index 00000000..5d0fdbd5 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyGift.md @@ -0,0 +1,15 @@ +# CampaignsVouchersCreateResponseBodyGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/CampaignsVouchersCreateResponseBodyLoyaltyCard.md b/docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..32cf1648 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# CampaignsVouchersCreateResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/CampaignsVouchersCreateResponseBodyPublish.md b/docs/CampaignsVouchersCreateResponseBodyPublish.md new file mode 100644 index 00000000..7afcbdc5 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyPublish.md @@ -0,0 +1,15 @@ +# CampaignsVouchersCreateResponseBodyPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/CampaignsVouchersCreateResponseBodyRedemption.md b/docs/CampaignsVouchersCreateResponseBodyRedemption.md new file mode 100644 index 00000000..36ca89e6 --- /dev/null +++ b/docs/CampaignsVouchersCreateResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# CampaignsVouchersCreateResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/CategoriesApi.md b/docs/CategoriesApi.md new file mode 100644 index 00000000..eced60e1 --- /dev/null +++ b/docs/CategoriesApi.md @@ -0,0 +1,440 @@ +# voucherify.CategoriesApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_category**](CategoriesApi.md#create_category) | **POST** /v1/categories | Create Category +[**delete_category**](CategoriesApi.md#delete_category) | **DELETE** /v1/categories/{categoryId} | Delete Category +[**get_category**](CategoriesApi.md#get_category) | **GET** /v1/categories/{categoryId} | Get Category +[**list_categories**](CategoriesApi.md#list_categories) | **GET** /v1/categories | List Categories +[**update_category**](CategoriesApi.md#update_category) | **PUT** /v1/categories/{categoryId} | Update Category + + +# **create_category** +> CategoriesCreateResponseBody create_category(categories_create_request_body=categories_create_request_body) + +Create Category + +Create category with a specific name and hierarchy. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.categories_create_request_body import CategoriesCreateRequestBody +from voucherify.models.categories_create_response_body import CategoriesCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CategoriesApi(api_client) + categories_create_request_body = {"name":"Eighth","hierarchy":8} # CategoriesCreateRequestBody | Specify the details of the category that you would like to create. (optional) + + try: + # Create Category + api_response = api_instance.create_category(categories_create_request_body=categories_create_request_body) + print("The response of CategoriesApi->create_category:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CategoriesApi->create_category: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **categories_create_request_body** | [**CategoriesCreateRequestBody**](CategoriesCreateRequestBody.md)| Specify the details of the category that you would like to create. | [optional] + +### Return type + +[**CategoriesCreateResponseBody**](CategoriesCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a newly created category object. | - | + +[[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) + +# **delete_category** +> delete_category(category_id) + +Delete Category + +Delete a category by the category ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CategoriesApi(api_client) + category_id = 'category_id_example' # str | Unique category ID assigned by Voucherify. + + try: + # Delete Category + api_instance.delete_category(category_id) + except Exception as e: + print("Exception when calling CategoriesApi->delete_category: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **category_id** | **str**| Unique category ID assigned by Voucherify. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | No content is returned. | - | + +[[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) + +# **get_category** +> CategoriesGetResponseBody get_category(category_id) + +Get Category + +Retrieve a category by the category ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.categories_get_response_body import CategoriesGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CategoriesApi(api_client) + category_id = 'category_id_example' # str | Unique category ID assigned by Voucherify. + + try: + # Get Category + api_response = api_instance.get_category(category_id) + print("The response of CategoriesApi->get_category:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CategoriesApi->get_category: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **category_id** | **str**| Unique category ID assigned by Voucherify. | + +### Return type + +[**CategoriesGetResponseBody**](CategoriesGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a category object. | - | + +[[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) + +# **list_categories** +> CategoriesListResponseBody list_categories() + +List Categories + +List all categories. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.categories_list_response_body import CategoriesListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CategoriesApi(api_client) + + try: + # List Categories + api_response = api_instance.list_categories() + print("The response of CategoriesApi->list_categories:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CategoriesApi->list_categories: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**CategoriesListResponseBody**](CategoriesListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of category objects. | - | + +[[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) + +# **update_category** +> CategoriesUpdateResponseBody update_category(category_id, categories_update_request_body=categories_update_request_body) + +Update Category + +Update category using the category ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.categories_update_request_body import CategoriesUpdateRequestBody +from voucherify.models.categories_update_response_body import CategoriesUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CategoriesApi(api_client) + category_id = 'category_id_example' # str | Unique category ID assigned by Voucherify. + categories_update_request_body = {"name":"Summer","hierarchy":1} # CategoriesUpdateRequestBody | Specify the details of the category that you would like to update. (optional) + + try: + # Update Category + api_response = api_instance.update_category(category_id, categories_update_request_body=categories_update_request_body) + print("The response of CategoriesApi->update_category:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CategoriesApi->update_category: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **category_id** | **str**| Unique category ID assigned by Voucherify. | + **categories_update_request_body** | [**CategoriesUpdateRequestBody**](CategoriesUpdateRequestBody.md)| Specify the details of the category that you would like to update. | [optional] + +### Return type + +[**CategoriesUpdateResponseBody**](CategoriesUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a category object with a refreshed `updated_at` property. | - | + +[[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) + diff --git a/docs/CategoriesCreateRequestBody.md b/docs/CategoriesCreateRequestBody.md new file mode 100644 index 00000000..00d486e9 --- /dev/null +++ b/docs/CategoriesCreateRequestBody.md @@ -0,0 +1,14 @@ +# CategoriesCreateRequestBody + +Request body schema for **POST** `v1/categories`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] + +[[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/CategoriesCreateResponseBody.md b/docs/CategoriesCreateResponseBody.md new file mode 100644 index 00000000..0dac2ceb --- /dev/null +++ b/docs/CategoriesCreateResponseBody.md @@ -0,0 +1,17 @@ +# CategoriesCreateResponseBody + +Response body schema for **POST** `v1/categories`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**name** | **str** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **str** | | [optional] [default to 'category'] +**created_at** | **datetime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/CategoriesGetResponseBody.md b/docs/CategoriesGetResponseBody.md new file mode 100644 index 00000000..b3c2ee44 --- /dev/null +++ b/docs/CategoriesGetResponseBody.md @@ -0,0 +1,19 @@ +# CategoriesGetResponseBody + +Response body schema for **GET** `v1/categories/{categoryId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**name** | **str** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the category. | [optional] [default to 'category'] +**created_at** | **datetime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] +**stacking_rules_type** | **str** | The type of the stacking rule eligibility. | [optional] + +[[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/CategoriesListResponseBody.md b/docs/CategoriesListResponseBody.md new file mode 100644 index 00000000..1583737b --- /dev/null +++ b/docs/CategoriesListResponseBody.md @@ -0,0 +1,16 @@ +# CategoriesListResponseBody + +Response body schema for **GET** `v1/categories`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about categories in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of category objects. | [optional] [default to 'data'] +**data** | [**List[Category]**](Category.md) | | [optional] +**total** | **int** | Total number of categories. | [optional] + +[[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/CategoriesUpdateRequestBody.md b/docs/CategoriesUpdateRequestBody.md new file mode 100644 index 00000000..e3f804f6 --- /dev/null +++ b/docs/CategoriesUpdateRequestBody.md @@ -0,0 +1,14 @@ +# CategoriesUpdateRequestBody + +Request body schema for **PUT** `v1/categories/{categoryId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] + +[[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/CategoriesUpdateResponseBody.md b/docs/CategoriesUpdateResponseBody.md new file mode 100644 index 00000000..8ed5017d --- /dev/null +++ b/docs/CategoriesUpdateResponseBody.md @@ -0,0 +1,18 @@ +# CategoriesUpdateResponseBody + +Response body schema for **PUT** `v1/categories/{categoryId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**name** | **str** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **str** | | [optional] [default to 'category'] +**created_at** | **datetime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] + +[[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/Category.md b/docs/Category.md new file mode 100644 index 00000000..79d52977 --- /dev/null +++ b/docs/Category.md @@ -0,0 +1,19 @@ +# Category + +This is an object representing a category. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**name** | **str** | Category name. | [optional] +**hierarchy** | **int** | Category hierarchy. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the category. | [optional] [default to 'category'] +**created_at** | **datetime** | Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format. | [optional] +**stacking_rules_type** | **str** | The type of the stacking rule eligibility. | [optional] + +[[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/ClientEventsCreateRequestBody.md b/docs/ClientEventsCreateRequestBody.md new file mode 100644 index 00000000..f6cda13b --- /dev/null +++ b/docs/ClientEventsCreateRequestBody.md @@ -0,0 +1,17 @@ +# ClientEventsCreateRequestBody + +Request body schema for **POST** `v1/events`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event** | **str** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | [optional] +**customer** | [**Customer**](Customer.md) | | +**referral** | [**ClientEventsCreateRequestBodyReferral**](ClientEventsCreateRequestBodyReferral.md) | | [optional] +**loyalty** | [**ClientEventsCreateRequestBodyLoyalty**](ClientEventsCreateRequestBodyLoyalty.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**. | [optional] + +[[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/ClientEventsCreateRequestBodyLoyalty.md b/docs/ClientEventsCreateRequestBodyLoyalty.md new file mode 100644 index 00000000..f63c9c41 --- /dev/null +++ b/docs/ClientEventsCreateRequestBodyLoyalty.md @@ -0,0 +1,13 @@ +# ClientEventsCreateRequestBodyLoyalty + +If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. | [optional] + +[[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/ClientEventsCreateRequestBodyReferral.md b/docs/ClientEventsCreateRequestBodyReferral.md new file mode 100644 index 00000000..b6ce31b7 --- /dev/null +++ b/docs/ClientEventsCreateRequestBodyReferral.md @@ -0,0 +1,14 @@ +# ClientEventsCreateRequestBodyReferral + +If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | A code through which a new visitor has been referred to a service. | [optional] +**referrer_id** | **str** | Unique ID of the referring person - it is optional and not required if the referral **code** is provided. | [optional] + +[[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/ClientEventsCreateResponseBody.md b/docs/ClientEventsCreateResponseBody.md new file mode 100644 index 00000000..9bcae3ea --- /dev/null +++ b/docs/ClientEventsCreateResponseBody.md @@ -0,0 +1,18 @@ +# ClientEventsCreateResponseBody + +Response body schema for **POST** `v1/events`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The object represented is an `event`. | [optional] [default to 'event'] +**type** | **str** | The event name. | [optional] +**customer** | [**SimpleCustomerRequiredObjectType**](SimpleCustomerRequiredObjectType.md) | | +**referral** | **object** | A `null` referral object. | [optional] +**loyalty** | **object** | A `null` loyalty object. | [optional] +**metadata** | **object** | | [optional] + +[[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/ClientPromotionsTiersListResponseBody.md b/docs/ClientPromotionsTiersListResponseBody.md new file mode 100644 index 00000000..b4f07727 --- /dev/null +++ b/docs/ClientPromotionsTiersListResponseBody.md @@ -0,0 +1,17 @@ +# ClientPromotionsTiersListResponseBody + +Response body schema for **GET** `v1/client/v1/promotions/tiers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional] [default to 'tiers'] +**tiers** | [**List[PromotionTier]**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] +**total** | **int** | Total number of promotion tiers. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results. | [optional] + +[[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/ClientQualificationsCheckEligibilityRequestBody.md b/docs/ClientQualificationsCheckEligibilityRequestBody.md new file mode 100644 index 00000000..f37f109a --- /dev/null +++ b/docs/ClientQualificationsCheckEligibilityRequestBody.md @@ -0,0 +1,18 @@ +# ClientQualificationsCheckEligibilityRequestBody + +Request body schema for **POST** `v1/qualifications`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer** | [**Customer**](Customer.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**tracking_id** | **str** | Is correspondent to Customer's source_id | [optional] +**scenario** | **str** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] +**options** | [**QualificationsOption**](QualificationsOption.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] + +[[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/ClientQualificationsCheckEligibilityResponseBody.md b/docs/ClientQualificationsCheckEligibilityResponseBody.md new file mode 100644 index 00000000..3bc7b030 --- /dev/null +++ b/docs/ClientQualificationsCheckEligibilityResponseBody.md @@ -0,0 +1,16 @@ +# ClientQualificationsCheckEligibilityResponseBody + +Response body schema for **POST** `v1/qualifications`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemables** | [**QualificationsRedeemables**](QualificationsRedeemables.md) | | [optional] +**tracking_id** | **str** | This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**stacking_rules** | [**StackingRules**](StackingRules.md) | | [optional] + +[[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/ClientRedemptionsRedeemRequestBody.md b/docs/ClientRedemptionsRedeemRequestBody.md new file mode 100644 index 00000000..d6868f59 --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBody.md @@ -0,0 +1,19 @@ +# ClientRedemptionsRedeemRequestBody + +Response body schema for **POST** `v1/redemptions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**ClientRedemptionsRedeemRequestBodyOptions**](ClientRedemptionsRedeemRequestBodyOptions.md) | | [optional] +**redeemables** | [**List[ClientRedemptionsRedeemRequestBodyRedeemablesItem]**](ClientRedemptionsRedeemRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**session** | [**Session**](Session.md) | | [optional] +**tracking_id** | **str** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[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/ClientRedemptionsRedeemRequestBodyOptions.md b/docs/ClientRedemptionsRedeemRequestBodyOptions.md new file mode 100644 index 00000000..f44b082d --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyOptions.md @@ -0,0 +1,13 @@ +# ClientRedemptionsRedeemRequestBodyOptions + +Configure parameters returned in the response. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **List[str]** | Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.<br>- Returns redemption object `metadata`.<br>- Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[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/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..0a1f0db8 --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItem.md @@ -0,0 +1,15 @@ +# ClientRedemptionsRedeemRequestBodyRedeemablesItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | | [optional] +**id** | **str** | | [optional] +**gift** | [**ClientRedemptionsRedeemRequestBodyRedeemablesItemGift**](ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**ClientRedemptionsRedeemRequestBodyRedeemablesItemReward**](ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md) | | [optional] + +[[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/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..8b828532 --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.md @@ -0,0 +1,13 @@ +# ClientRedemptionsRedeemRequestBodyRedeemablesItemGift + +Contains information on the number of gift card credits that the customer wants to apply to the order. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[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/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..efa50786 --- /dev/null +++ b/docs/ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.md @@ -0,0 +1,14 @@ +# ClientRedemptionsRedeemRequestBodyRedeemablesItemReward + +Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[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/ClientRedemptionsRedeemResponseBody.md b/docs/ClientRedemptionsRedeemResponseBody.md new file mode 100644 index 00000000..0d8251fc --- /dev/null +++ b/docs/ClientRedemptionsRedeemResponseBody.md @@ -0,0 +1,17 @@ +# ClientRedemptionsRedeemResponseBody + +Response body schema for **POST** `v1/redemptions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**List[Redemption]**](Redemption.md) | | [optional] +**parent_redemption** | [**Redemption**](Redemption.md) | | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**inapplicable_redeemables** | [**List[ValidationsRedeemableInapplicable]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**skipped_redeemables** | [**List[ValidationsRedeemableSkipped]**](ValidationsRedeemableSkipped.md) | Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. | [optional] + +[[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/ClientSideApi.md b/docs/ClientSideApi.md new file mode 100644 index 00000000..f0c6841f --- /dev/null +++ b/docs/ClientSideApi.md @@ -0,0 +1,462 @@ +# voucherify.ClientSideApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**check_eligibility_client_side**](ClientSideApi.md#check_eligibility_client_side) | **POST** /client/v1/qualifications | Check Eligibility (client-side) +[**list_promotion_tiers_client_side**](ClientSideApi.md#list_promotion_tiers_client_side) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (client-side) +[**redeem_stacked_discounts_client_side**](ClientSideApi.md#redeem_stacked_discounts_client_side) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) +[**track_custom_event_client_side**](ClientSideApi.md#track_custom_event_client_side) | **POST** /client/v1/events | Track Custom Event (client-side) +[**validate_stacked_discounts_client_side**](ClientSideApi.md#validate_stacked_discounts_client_side) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) + + +# **check_eligibility_client_side** +> ClientQualificationsCheckEligibilityResponseBody check_eligibility_client_side(client_qualifications_check_eligibility_request_body=client_qualifications_check_eligibility_request_body) + +Check Eligibility (client-side) + +Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + +### Example + +* Api Key Authentication (X-Client-Application-Id): +* Api Key Authentication (X-Client-Token): + +```python +import voucherify +from voucherify.models.client_qualifications_check_eligibility_request_body import ClientQualificationsCheckEligibilityRequestBody +from voucherify.models.client_qualifications_check_eligibility_response_body import ClientQualificationsCheckEligibilityResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-Client-Application-Id +configuration.api_key['X-Client-Application-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Application-Id'] = 'Bearer' + +# Configure API key authorization: X-Client-Token +configuration.api_key['X-Client-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ClientSideApi(api_client) + client_qualifications_check_eligibility_request_body = voucherify.ClientQualificationsCheckEligibilityRequestBody() # ClientQualificationsCheckEligibilityRequestBody | Define order and customer context. (optional) + + try: + # Check Eligibility (client-side) + api_response = api_instance.check_eligibility_client_side(client_qualifications_check_eligibility_request_body=client_qualifications_check_eligibility_request_body) + print("The response of ClientSideApi->check_eligibility_client_side:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClientSideApi->check_eligibility_client_side: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client_qualifications_check_eligibility_request_body** | [**ClientQualificationsCheckEligibilityRequestBody**](ClientQualificationsCheckEligibilityRequestBody.md)| Define order and customer context. | [optional] + +### Return type + +[**ClientQualificationsCheckEligibilityResponseBody**](ClientQualificationsCheckEligibilityResponseBody.md) + +### Authorization + +[X-Client-Application-Id](../README.md#X-Client-Application-Id), [X-Client-Token](../README.md#X-Client-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a qualifications object. | - | + +[[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) + +# **list_promotion_tiers_client_side** +> ClientPromotionsTiersListResponseBody list_promotion_tiers_client_side(origin, is_available=is_available, limit=limit, page=page, order=order) + +List Promotion Tiers (client-side) + +This method enables you to list promotion tiers. + +### Example + +* Api Key Authentication (X-Client-Application-Id): +* Api Key Authentication (X-Client-Token): + +```python +import voucherify +from voucherify.models.client_promotions_tiers_list_response_body import ClientPromotionsTiersListResponseBody +from voucherify.models.parameter_order_list_promotion_tiers_client_side import ParameterOrderListPromotionTiersClientSide +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-Client-Application-Id +configuration.api_key['X-Client-Application-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Application-Id'] = 'Bearer' + +# Configure API key authorization: X-Client-Token +configuration.api_key['X-Client-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ClientSideApi(api_client) + origin = 'origin_example' # str | Indicates the origin (scheme, hostname, and port). + is_available = True # bool | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListPromotionTiersClientSide() # ParameterOrderListPromotionTiersClientSide | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Promotion Tiers (client-side) + api_response = api_instance.list_promotion_tiers_client_side(origin, is_available=is_available, limit=limit, page=page, order=order) + print("The response of ClientSideApi->list_promotion_tiers_client_side:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClientSideApi->list_promotion_tiers_client_side: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **origin** | **str**| Indicates the origin (scheme, hostname, and port). | + **is_available** | **bool**| This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. | [optional] + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListPromotionTiersClientSide**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**ClientPromotionsTiersListResponseBody**](ClientPromotionsTiersListResponseBody.md) + +### Authorization + +[X-Client-Application-Id](../README.md#X-Client-Application-Id), [X-Client-Token](../README.md#X-Client-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with a `tiers` property that contains an array of promotion tiers. | - | + +[[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) + +# **redeem_stacked_discounts_client_side** +> ClientRedemptionsRedeemResponseBody redeem_stacked_discounts_client_side(origin, client_redemptions_redeem_request_body=client_redemptions_redeem_request_body) + +Redeem Stackable Discounts (client-side) + +This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. + +### Example + +* Api Key Authentication (X-Client-Application-Id): +* Api Key Authentication (X-Client-Token): + +```python +import voucherify +from voucherify.models.client_redemptions_redeem_request_body import ClientRedemptionsRedeemRequestBody +from voucherify.models.client_redemptions_redeem_response_body import ClientRedemptionsRedeemResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-Client-Application-Id +configuration.api_key['X-Client-Application-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Application-Id'] = 'Bearer' + +# Configure API key authorization: X-Client-Token +configuration.api_key['X-Client-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ClientSideApi(api_client) + origin = 'origin_example' # str | Indicates the origin (scheme, hostname, and port). + client_redemptions_redeem_request_body = {"customer":{"source_id":"sample_customer","metadata":{"key":"value"}},"options":{"expand":["order","redeemable","category"]},"redeemables":[{"object":"voucher","id":"voucher-code"}],"session":{"type":"LOCK","key":"session_key"},"order":{"amount":55000,"status":"PAID","items":[{"quantity":2,"price":20000,"source_id":"sample product1","related_object":"product","product":{"metadata":{"key":"value"}}},{"quantity":1,"price":15000,"source_id":"sample product2","related_object":"product","product":{"metadata":{"key":"value"}}}],"metadata":{"key":"value"}}} # ClientRedemptionsRedeemRequestBody | (optional) + + try: + # Redeem Stackable Discounts (client-side) + api_response = api_instance.redeem_stacked_discounts_client_side(origin, client_redemptions_redeem_request_body=client_redemptions_redeem_request_body) + print("The response of ClientSideApi->redeem_stacked_discounts_client_side:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClientSideApi->redeem_stacked_discounts_client_side: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **origin** | **str**| Indicates the origin (scheme, hostname, and port). | + **client_redemptions_redeem_request_body** | [**ClientRedemptionsRedeemRequestBody**](ClientRedemptionsRedeemRequestBody.md)| | [optional] + +### Return type + +[**ClientRedemptionsRedeemResponseBody**](ClientRedemptionsRedeemResponseBody.md) + +### Authorization + +[X-Client-Application-Id](../README.md#X-Client-Application-Id), [X-Client-Token](../README.md#X-Client-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Depending on your project settings: all redeemables must be valid or just one must be valid to result as valid redemption. See https://support.voucherify.io/article/604-stacking-rules#application-rules | - | + +[[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) + +# **track_custom_event_client_side** +> ClientEventsCreateResponseBody track_custom_event_client_side(origin, client_events_create_request_body=client_events_create_request_body) + +Track Custom Event (client-side) + +To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + +### Example + +* Api Key Authentication (X-Client-Application-Id): +* Api Key Authentication (X-Client-Token): + +```python +import voucherify +from voucherify.models.client_events_create_request_body import ClientEventsCreateRequestBody +from voucherify.models.client_events_create_response_body import ClientEventsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-Client-Application-Id +configuration.api_key['X-Client-Application-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Application-Id'] = 'Bearer' + +# Configure API key authorization: X-Client-Token +configuration.api_key['X-Client-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ClientSideApi(api_client) + origin = 'origin_example' # str | Indicates the origin (scheme, hostname, and port). + client_events_create_request_body = {"event":"user_subscribed","customer":{"source_id":"source_customer_event"},"referral":{"code":"46jL0kYI","referrer_id":"cust_Vzck5i8U3OhcEUFY6MKhN9Rv"},"metadata":{"login":"bob","pricing_plan":"PP1","volume_number":4}} # ClientEventsCreateRequestBody | Specify the details of the custom event. (optional) + + try: + # Track Custom Event (client-side) + api_response = api_instance.track_custom_event_client_side(origin, client_events_create_request_body=client_events_create_request_body) + print("The response of ClientSideApi->track_custom_event_client_side:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClientSideApi->track_custom_event_client_side: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **origin** | **str**| Indicates the origin (scheme, hostname, and port). | + **client_events_create_request_body** | [**ClientEventsCreateRequestBody**](ClientEventsCreateRequestBody.md)| Specify the details of the custom event. | [optional] + +### Return type + +[**ClientEventsCreateResponseBody**](ClientEventsCreateResponseBody.md) + +### Authorization + +[X-Client-Application-Id](../README.md#X-Client-Application-Id), [X-Client-Token](../README.md#X-Client-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the event type if the event was received by the application. | - | + +[[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) + +# **validate_stacked_discounts_client_side** +> ClientValidationsValidateResponseBody validate_stacked_discounts_client_side(origin, client_validations_validate_request_body=client_validations_validate_request_body) + +Validate Stackable Discounts (client-side) + +Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. + +### Example + +* Api Key Authentication (X-Client-Application-Id): +* Api Key Authentication (X-Client-Token): + +```python +import voucherify +from voucherify.models.client_validations_validate_request_body import ClientValidationsValidateRequestBody +from voucherify.models.client_validations_validate_response_body import ClientValidationsValidateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-Client-Application-Id +configuration.api_key['X-Client-Application-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Application-Id'] = 'Bearer' + +# Configure API key authorization: X-Client-Token +configuration.api_key['X-Client-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-Client-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ClientSideApi(api_client) + origin = 'origin_example' # str | Indicates the origin (scheme, hostname, and port). + client_validations_validate_request_body = {"customer":{"source_id":"sample_customer","metadata":{"key":"value"}},"options":{"expand":["order","redeemable","category"]},"redeemables":[{"object":"voucher","id":"voucher-code"}],"session":{"type":"LOCK"},"order":{"amount":55000,"status":"PAID","items":[{"quantity":2,"price":20000,"source_id":"sample product1","related_object":"product","product":{"metadata":{"key":"value"}}},{"quantity":1,"price":15000,"source_id":"sample product2","related_object":"product","product":{"metadata":{"key":"value"}}}],"metadata":{"key":"value"}}} # ClientValidationsValidateRequestBody | (optional) + + try: + # Validate Stackable Discounts (client-side) + api_response = api_instance.validate_stacked_discounts_client_side(origin, client_validations_validate_request_body=client_validations_validate_request_body) + print("The response of ClientSideApi->validate_stacked_discounts_client_side:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ClientSideApi->validate_stacked_discounts_client_side: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **origin** | **str**| Indicates the origin (scheme, hostname, and port). | + **client_validations_validate_request_body** | [**ClientValidationsValidateRequestBody**](ClientValidationsValidateRequestBody.md)| | [optional] + +### Return type + +[**ClientValidationsValidateResponseBody**](ClientValidationsValidateResponseBody.md) + +### Authorization + +[X-Client-Application-Id](../README.md#X-Client-Application-Id), [X-Client-Token](../README.md#X-Client-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Depending on your project settings: all redeemables must be valid or just one must be valid to result as valid validation. See https://support.voucherify.io/article/604-stacking-rules#application-rules | - | + +[[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) + diff --git a/docs/ClientValidationsValidateRequestBody.md b/docs/ClientValidationsValidateRequestBody.md new file mode 100644 index 00000000..3cc88ec5 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBody.md @@ -0,0 +1,19 @@ +# ClientValidationsValidateRequestBody + +Response body schema for **POST** `v1/validations`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**ClientValidationsValidateRequestBodyOptions**](ClientValidationsValidateRequestBodyOptions.md) | | [optional] +**redeemables** | [**List[ClientValidationsValidateRequestBodyRedeemablesItem]**](ClientValidationsValidateRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**session** | [**Session**](Session.md) | | [optional] +**tracking_id** | **str** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[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/ClientValidationsValidateRequestBodyOptions.md b/docs/ClientValidationsValidateRequestBodyOptions.md new file mode 100644 index 00000000..def01267 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyOptions.md @@ -0,0 +1,13 @@ +# ClientValidationsValidateRequestBodyOptions + +Configure parameters returned in the response. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **List[str]** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[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/ClientValidationsValidateRequestBodyRedeemablesItem.md b/docs/ClientValidationsValidateRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..01d7d4c4 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyRedeemablesItem.md @@ -0,0 +1,15 @@ +# ClientValidationsValidateRequestBodyRedeemablesItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | | [optional] +**id** | **str** | | [optional] +**gift** | [**ClientValidationsValidateRequestBodyRedeemablesItemGift**](ClientValidationsValidateRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**ClientValidationsValidateRequestBodyRedeemablesItemReward**](ClientValidationsValidateRequestBodyRedeemablesItemReward.md) | | [optional] + +[[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/ClientValidationsValidateRequestBodyRedeemablesItemGift.md b/docs/ClientValidationsValidateRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..c6553a52 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyRedeemablesItemGift.md @@ -0,0 +1,13 @@ +# ClientValidationsValidateRequestBodyRedeemablesItemGift + +Contains information on the number of gift card credits that the customer wants to apply to the order. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[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/ClientValidationsValidateRequestBodyRedeemablesItemReward.md b/docs/ClientValidationsValidateRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..a6782070 --- /dev/null +++ b/docs/ClientValidationsValidateRequestBodyRedeemablesItemReward.md @@ -0,0 +1,14 @@ +# ClientValidationsValidateRequestBodyRedeemablesItemReward + +Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[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/ClientValidationsValidateResponseBody.md b/docs/ClientValidationsValidateResponseBody.md new file mode 100644 index 00000000..587293d1 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBody.md @@ -0,0 +1,20 @@ +# ClientValidationsValidateResponseBody + +Response body schema for POST `/validations`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**valid** | **bool** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | [optional] +**redeemables** | [**List[ClientValidationsValidateResponseBodyRedeemablesItem]**](ClientValidationsValidateResponseBodyRedeemablesItem.md) | | [optional] +**skipped_redeemables** | [**List[ValidationsRedeemableSkipped]**](ValidationsRedeemableSkipped.md) | Lists validation results of each skipped redeemable. | [optional] +**inapplicable_redeemables** | [**List[ValidationsRedeemableInapplicable]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**session** | [**Session**](Session.md) | | [optional] +**stacking_rules** | [**StackingRules**](StackingRules.md) | | + +[[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/ClientValidationsValidateResponseBodyRedeemablesItem.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItem.md new file mode 100644 index 00000000..814fa786 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItem.md @@ -0,0 +1,20 @@ +# ClientValidationsValidateResponseBodyRedeemablesItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **str** | | [optional] +**id** | **str** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **str** | Redeemable's object type. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**applicable_to** | [**ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicable_to** | [**InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**result** | [**ClientValidationsValidateResponseBodyRedeemablesItemResult**](ClientValidationsValidateResponseBodyRedeemablesItemResult.md) | | [optional] +**metadata** | **object** | | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/ClientValidationsValidateResponseBodyRedeemablesItemResult.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResult.md new file mode 100644 index 00000000..bbfc56ae --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResult.md @@ -0,0 +1,16 @@ +# ClientValidationsValidateResponseBodyRedeemablesItemResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount**](ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) | | [optional] +**gift** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultGift**](ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md) | | [optional] +**loyalty_card** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard**](ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) | | [optional] +**error** | [**Error**](Error.md) | | [optional] +**details** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultDetails**](ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md) | | [optional] + +[[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/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md new file mode 100644 index 00000000..2d4a3fc3 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.md @@ -0,0 +1,13 @@ +# ClientValidationsValidateResponseBodyRedeemablesItemResultDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **str** | | [optional] +**message** | **str** | | [optional] + +[[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/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md new file mode 100644 index 00000000..96487d16 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md @@ -0,0 +1,28 @@ +# ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**amount_off** | **float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] +**amount_off_formula** | **str** | | [optional] +**aggregated_amount_limit** | **int** | Maximum discount amount per order. | [optional] +**effect** | **str** | | [optional] +**is_dynamic** | **bool** | Flag indicating whether the discount was calculated using a formula. | [optional] +**unit_off** | **int** | Number of units to be granted a full value discount. | [optional] +**unit_off_formula** | **str** | | [optional] +**unit_type** | **str** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct**](ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) | | [optional] +**sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] +**units** | [**List[DiscountUnitMultipleOneUnit]**](DiscountUnitMultipleOneUnit.md) | | [optional] +**percent_off** | **float** | The percent discount that the customer will receive. | [optional] +**percent_off_formula** | **str** | | [optional] +**amount_limit** | **float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**fixed_amount** | **float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] +**fixed_amount_formula** | **str** | | [optional] + +[[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/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md new file mode 100644 index 00000000..f028d240 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md @@ -0,0 +1,14 @@ +# ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID, assigned by Voucherify. | [optional] +**source_id** | **str** | Product's source ID. | [optional] +**name** | **str** | Product name. | [optional] + +[[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/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md new file mode 100644 index 00000000..1d0649f3 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultGift.md @@ -0,0 +1,13 @@ +# ClientValidationsValidateResponseBodyRedeemablesItemResultGift + +Stores the amount of gift card credits to be applied in the redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md new file mode 100644 index 00000000..500b61b4 --- /dev/null +++ b/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md @@ -0,0 +1,12 @@ +# ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total number of loyalty points to be applied in the redemption. | [optional] + +[[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/CodeConfig.md b/docs/CodeConfig.md new file mode 100644 index 00000000..86aa6599 --- /dev/null +++ b/docs/CodeConfig.md @@ -0,0 +1,18 @@ +# CodeConfig + +Contains information about the config used for the voucher code. Defines the code's pattern (prefix, postfix, length, charset, etc). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **float** | Number of characters in a generated code (excluding prefix and postfix). | [optional] +**charset** | **str** | Characters that can appear in the code. Examples: - Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` - Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` - Numbers: `0123456789` - Custom: a custom character set | [optional] +**prefix** | **str** | A text appended before the code. | [optional] +**postfix** | **str** | A text appended after the code. | [optional] +**pattern** | **str** | A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`. | [optional] +**initial_count** | **int** | Internal value, does not change anything if provided. | [optional] + +[[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/CreatePublicationCampaign.md b/docs/CreatePublicationCampaign.md new file mode 100644 index 00000000..480a0aa3 --- /dev/null +++ b/docs/CreatePublicationCampaign.md @@ -0,0 +1,14 @@ +# CreatePublicationCampaign + +Create publication with campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify. | [optional] +**count** | **int** | Number of vouchers to be published to customer. | [optional] + +[[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/Customer.md b/docs/Customer.md new file mode 100644 index 00000000..4f5ec957 --- /dev/null +++ b/docs/Customer.md @@ -0,0 +1,21 @@ +# Customer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomerAddress**](CustomerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomerActivity.md b/docs/CustomerActivity.md new file mode 100644 index 00000000..5b6263b5 --- /dev/null +++ b/docs/CustomerActivity.md @@ -0,0 +1,17 @@ +# CustomerActivity + +This is an object representing customer activity. This is a general object which presents moments from customers' activity. There are all types of different events that customers perform during their journey once they participate in Promotions. Events describe moments when customers redeem coupons and earn points or rewards. The list of all types of activities is listed below. The details describing the activity are collected in a property named `data`. In this object, software integrators will find all further information explaining the event context. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique event ID, assigned by Voucherify. | [optional] +**type** | **str** | Event type. | [optional] +**data** | **object** | Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the customer activity occurred in ISO 8601 format. | [optional] +**group_id** | **str** | Unique identifier of the request that caused the event. | [optional] + +[[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/CustomerAddress.md b/docs/CustomerAddress.md new file mode 100644 index 00000000..d5618531 --- /dev/null +++ b/docs/CustomerAddress.md @@ -0,0 +1,18 @@ +# CustomerAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomerId.md b/docs/CustomerId.md new file mode 100644 index 00000000..91bfd32c --- /dev/null +++ b/docs/CustomerId.md @@ -0,0 +1,13 @@ +# CustomerId + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/CustomerLoyalty.md b/docs/CustomerLoyalty.md new file mode 100644 index 00000000..640de670 --- /dev/null +++ b/docs/CustomerLoyalty.md @@ -0,0 +1,14 @@ +# CustomerLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Customer's loyalty points. | [optional] +**referred_customers** | **int** | Total number of customers referred by the customer. | [optional] +**campaigns** | **object** | Contains campaigns with details about point balances and how many customers were referred by the customer. | [optional] + +[[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/CustomerRedeemable.md b/docs/CustomerRedeemable.md new file mode 100644 index 00000000..b16025e2 --- /dev/null +++ b/docs/CustomerRedeemable.md @@ -0,0 +1,22 @@ +# CustomerRedeemable + +Single customer's redeemable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redeemable holder identifier. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the redeemable was assigned. The value is shown in the ISO 8601 format. | [optional] +**redeemable_id** | **str** | Identifier of the redeemable item. | [optional] +**redeemable_object** | **str** | Type of the redeemable. | [optional] +**customer_id** | **str** | Identifier of the customer. | [optional] +**holder_role** | **str** | Role of the holder. | [optional] [default to 'OWNER'] +**campaign_id** | **str** | Unique campaign identifier, assigned by Voucherify. | [optional] +**campaign_type** | **str** | Defines the type of the campaign. | [optional] [default to 'DISCOUNT_COUPONS'] +**voucher_type** | **str** | Defines the type of the voucher. | [optional] [default to 'DISCOUNT_VOUCHER'] +**redeemable** | [**CustomerRedeemableRedeemable**](CustomerRedeemableRedeemable.md) | | [optional] + +[[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/CustomerRedeemableRedeemable.md b/docs/CustomerRedeemableRedeemable.md new file mode 100644 index 00000000..a6c3c779 --- /dev/null +++ b/docs/CustomerRedeemableRedeemable.md @@ -0,0 +1,15 @@ +# CustomerRedeemableRedeemable + +Detailed information about the customer's redeemable item + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Type of the redeemable. | [optional] +**voucher** | [**RedeemableVoucher**](RedeemableVoucher.md) | | +**status** | **str** | Status of the redeemable. | [optional] [default to 'ACTIVE'] + +[[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/CustomerReferrals.md b/docs/CustomerReferrals.md new file mode 100644 index 00000000..3bb10226 --- /dev/null +++ b/docs/CustomerReferrals.md @@ -0,0 +1,14 @@ +# CustomerReferrals + +Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **int** | Total number of times this customer received a referral, i.e. was referred by another customer. | [optional] +**campaigns** | [**List[CustomerReferralsCampaignsItem]**](CustomerReferralsCampaignsItem.md) | Contains an array of campaigns that served as the source of a referral for the customer. | [optional] + +[[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/CustomerReferralsCampaignsItem.md b/docs/CustomerReferralsCampaignsItem.md new file mode 100644 index 00000000..1d710f54 --- /dev/null +++ b/docs/CustomerReferralsCampaignsItem.md @@ -0,0 +1,17 @@ +# CustomerReferralsCampaignsItem + +Contains information about the source of the referral. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign_id** | **str** | Unique campaign ID, assigned by Voucherify. | +**referrer_id** | **str** | Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer. | +**related_object_id** | **str** | Related object id | +**related_object_type** | **str** | Related object type, i.e. `redemption`. | +**var_date** | **datetime** | Timestamp representing the date and time when the customer was referred in ISO 8601 format. | + +[[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/CustomerSummary.md b/docs/CustomerSummary.md new file mode 100644 index 00000000..25a8b47a --- /dev/null +++ b/docs/CustomerSummary.md @@ -0,0 +1,13 @@ +# CustomerSummary + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**CustomerSummaryRedemptions**](CustomerSummaryRedemptions.md) | | +**orders** | [**CustomerSummaryOrders**](CustomerSummaryOrders.md) | | + +[[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/CustomerSummaryOrders.md b/docs/CustomerSummaryOrders.md new file mode 100644 index 00000000..bb2bed25 --- /dev/null +++ b/docs/CustomerSummaryOrders.md @@ -0,0 +1,16 @@ +# CustomerSummaryOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**total_count** | **int** | Total number of orders made by the customer. | [optional] +**average_amount** | **int** | Average amount spent on orders. `total_amount` &divide; `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**last_order_amount** | **int** | Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**last_order_date** | **datetime** | Timestamp representing the date and time of the customer's last order in ISO 8601 format. | [optional] + +[[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/CustomerSummaryRedemptions.md b/docs/CustomerSummaryRedemptions.md new file mode 100644 index 00000000..35a5d040 --- /dev/null +++ b/docs/CustomerSummaryRedemptions.md @@ -0,0 +1,19 @@ +# CustomerSummaryRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Total number of redemptions made by the customer. | [optional] +**total_failed** | **int** | Total number of redemptions that failed. | [optional] +**total_succeeded** | **int** | Total number of redemptions that succeeded. | [optional] +**total_rolled_back** | **int** | Total number of redemptions that were rolled back for the customer. | [optional] +**total_rollback_failed** | **int** | Total number of redemption rollbacks that failed. | [optional] +**total_rollback_succeeded** | **int** | Total number of redemption rollbacks that succeeded. | [optional] +**gift** | [**CustomerSummaryRedemptionsGift**](CustomerSummaryRedemptionsGift.md) | | [optional] +**loyalty_card** | [**CustomerSummaryRedemptionsLoyaltyCard**](CustomerSummaryRedemptionsLoyaltyCard.md) | | [optional] + +[[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/CustomerSummaryRedemptionsGift.md b/docs/CustomerSummaryRedemptionsGift.md new file mode 100644 index 00000000..b255cf9f --- /dev/null +++ b/docs/CustomerSummaryRedemptionsGift.md @@ -0,0 +1,14 @@ +# CustomerSummaryRedemptionsGift + +Summary of gift card credits. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemed_amount** | **int** | Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] [default to 0] +**amount_to_go** | **int** | Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] [default to 0] + +[[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/CustomerSummaryRedemptionsLoyaltyCard.md b/docs/CustomerSummaryRedemptionsLoyaltyCard.md new file mode 100644 index 00000000..7983b306 --- /dev/null +++ b/docs/CustomerSummaryRedemptionsLoyaltyCard.md @@ -0,0 +1,14 @@ +# CustomerSummaryRedemptionsLoyaltyCard + +Summary of loyalty points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemed_points** | **int** | Total number of loyalty points redeemed by the customer. | [optional] +**points_to_go** | **int** | Sum of remaining available point balance across all loyalty cards. | [optional] + +[[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/CustomerWithSummaryLoyaltyReferrals.md b/docs/CustomerWithSummaryLoyaltyReferrals.md new file mode 100644 index 00000000..a9a6e586 --- /dev/null +++ b/docs/CustomerWithSummaryLoyaltyReferrals.md @@ -0,0 +1,29 @@ +# CustomerWithSummaryLoyaltyReferrals + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] +**system_metadata** | **object** | Object used to store system metadata information. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**CustomerWithSummaryLoyaltyReferralsAssets**](CustomerWithSummaryLoyaltyReferralsAssets.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomerWithSummaryLoyaltyReferralsAddress**](CustomerWithSummaryLoyaltyReferralsAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomerWithSummaryLoyaltyReferralsAddress.md b/docs/CustomerWithSummaryLoyaltyReferralsAddress.md new file mode 100644 index 00000000..859823f1 --- /dev/null +++ b/docs/CustomerWithSummaryLoyaltyReferralsAddress.md @@ -0,0 +1,18 @@ +# CustomerWithSummaryLoyaltyReferralsAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomerWithSummaryLoyaltyReferralsAssets.md b/docs/CustomerWithSummaryLoyaltyReferralsAssets.md new file mode 100644 index 00000000..40c11a83 --- /dev/null +++ b/docs/CustomerWithSummaryLoyaltyReferralsAssets.md @@ -0,0 +1,13 @@ +# CustomerWithSummaryLoyaltyReferralsAssets + +Contains information about the customer's cockpit. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpit_url** | **str** | Customer's cockpit URL address. | [optional] + +[[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/CustomersActivityListResponseBody.md b/docs/CustomersActivityListResponseBody.md new file mode 100644 index 00000000..c1aed7c5 --- /dev/null +++ b/docs/CustomersActivityListResponseBody.md @@ -0,0 +1,17 @@ +# CustomersActivityListResponseBody + +Response body schema for **GET** `v1/customers/{customerId}/activity`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about customer activities in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of customer activity objects. | [optional] [default to 'data'] +**data** | [**List[CustomerActivity]**](CustomerActivity.md) | Array of customer activity objects. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] +**more_starting_after** | **str** | Returns an ID that can be used to return another page of results. Use the event ID in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. | [optional] + +[[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/CustomersApi.md b/docs/CustomersApi.md new file mode 100644 index 00000000..1208440e --- /dev/null +++ b/docs/CustomersApi.md @@ -0,0 +1,1109 @@ +# voucherify.CustomersApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_customer**](CustomersApi.md#create_customer) | **POST** /v1/customers | Create Customer +[**customer_permanently_deletion**](CustomersApi.md#customer_permanently_deletion) | **POST** /v1/customers/{customerId}/permanent-deletion | Delete Customer Permanently +[**delete_customer**](CustomersApi.md#delete_customer) | **DELETE** /v1/customers/{customerId} | Delete Customer +[**get_customer**](CustomersApi.md#get_customer) | **GET** /v1/customers/{customerId} | Get Customer +[**import_customers_using_csv**](CustomersApi.md#import_customers_using_csv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV +[**list_customer_activity**](CustomersApi.md#list_customer_activity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity +[**list_customer_redeemables**](CustomersApi.md#list_customer_redeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables +[**list_customer_segments**](CustomersApi.md#list_customer_segments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments +[**list_customers**](CustomersApi.md#list_customers) | **GET** /v1/customers | List Customers +[**update_customer**](CustomersApi.md#update_customer) | **PUT** /v1/customers/{customerId} | Update Customer +[**update_customers_in_bulk**](CustomersApi.md#update_customers_in_bulk) | **POST** /v1/customers/bulk/async | Update Customers in Bulk +[**update_customers_metadata_in_bulk**](CustomersApi.md#update_customers_metadata_in_bulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in Bulk + + +# **create_customer** +> CustomersCreateResponseBody create_customer(customers_create_request_body=customers_create_request_body) + +Create Customer + +Creates a customer object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_create_request_body import CustomersCreateRequestBody +from voucherify.models.customers_create_response_body import CustomersCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customers_create_request_body = {"source_id":"source_123","name":"Bob Smith","description":"A frequent customer","email":"bob.smith@email.com","phone":"+1 933 222 3333","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-01-01"} # CustomersCreateRequestBody | Create a customer with specified parameters. (optional) + + try: + # Create Customer + api_response = api_instance.create_customer(customers_create_request_body=customers_create_request_body) + print("The response of CustomersApi->create_customer:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->create_customer: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customers_create_request_body** | [**CustomersCreateRequestBody**](CustomersCreateRequestBody.md)| Create a customer with specified parameters. | [optional] + +### Return type + +[**CustomersCreateResponseBody**](CustomersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a customer object. | - | + +[[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) + +# **customer_permanently_deletion** +> CustomersPermanentDeletionCreateResponseBody customer_permanently_deletion(customer_id) + +Delete Customer Permanently + +The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_permanent_deletion_create_response_body import CustomersPermanentDeletionCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customer_id = 'customer_id_example' # str | A Voucherify customers id or source_id. + + try: + # Delete Customer Permanently + api_response = api_instance.customer_permanently_deletion(customer_id) + print("The response of CustomersApi->customer_permanently_deletion:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->customer_permanently_deletion: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer_id** | **str**| A Voucherify customers id or source_id. | + +### Return type + +[**CustomersPermanentDeletionCreateResponseBody**](CustomersPermanentDeletionCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a permanent deletion object and status of the deletion. | - | + +[[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) + +# **delete_customer** +> delete_customer(customer_id) + +Delete Customer + +This method deletes a customer. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customer_id = 'customer_id_example' # str | A Voucherify customers id or source_id. + + try: + # Delete Customer + api_instance.delete_customer(customer_id) + except Exception as e: + print("Exception when calling CustomersApi->delete_customer: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer_id** | **str**| A Voucherify customers id or source_id. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **get_customer** +> CustomersGetResponseBody get_customer(customer_id) + +Get Customer + +Retrieve customer details. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_get_response_body import CustomersGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customer_id = 'customer_id_example' # str | A Voucherify customers id or source_id. + + try: + # Get Customer + api_response = api_instance.get_customer(customer_id) + print("The response of CustomersApi->get_customer:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->get_customer: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer_id** | **str**| A Voucherify customers id or source_id. | + +### Return type + +[**CustomersGetResponseBody**](CustomersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a customer object if a valid identifier was provided. | - | + +[[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) + +# **import_customers_using_csv** +> CustomersImportCsvCreateResponseBody import_customers_using_csv(file=file) + +Import and Update Customers using CSV + +This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. ๐Ÿ“˜ Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_import_csv_create_response_body import CustomersImportCsvCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + file = None # bytearray | File path. (optional) + + try: + # Import and Update Customers using CSV + api_response = api_instance.import_customers_using_csv(file=file) + print("The response of CustomersApi->import_customers_using_csv:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->import_customers_using_csv: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **bytearray**| File path. | [optional] + +### Return type + +[**CustomersImportCsvCreateResponseBody**](CustomersImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **list_customer_activity** +> CustomersActivityListResponseBody list_customer_activity(customer_id, limit=limit, order=order, starting_after_id=starting_after_id, start_date=start_date, end_date=end_date, campaign_id=campaign_id, campaign_type=campaign_type, category=category, type=type) + +List Customer Activity + +Retrieve customer activities. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_activity_list_response_body import CustomersActivityListResponseBody +from voucherify.models.parameter_activity_category import ParameterActivityCategory +from voucherify.models.parameter_campaign_type import ParameterCampaignType +from voucherify.models.parameter_order_created_at import ParameterOrderCreatedAt +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customer_id = 'customer_id_example' # str | A Voucherify customers id or source ID of the customer who performed the activities. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderCreatedAt() # ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. (optional) + starting_after_id = 'starting_after_id_example' # str | A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + start_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. (optional) + end_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + campaign_id = 'campaign_id_example' # str | Requests only events related to specific campaign identified by its ID. (optional) + campaign_type = voucherify.ParameterCampaignType() # ParameterCampaignType | Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. (optional) + category = voucherify.ParameterActivityCategory() # ParameterActivityCategory | Filters activities for actions or effects. Allowed values: ACTION, EFFECT. (optional) + type = 'type_example' # str | Event name of the customer event. (optional) + + try: + # List Customer Activity + api_response = api_instance.list_customer_activity(customer_id, limit=limit, order=order, starting_after_id=starting_after_id, start_date=start_date, end_date=end_date, campaign_id=campaign_id, campaign_type=campaign_type, category=category, type=type) + print("The response of CustomersApi->list_customer_activity:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->list_customer_activity: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer_id** | **str**| A Voucherify customers id or source ID of the customer who performed the activities. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderCreatedAt**](.md)| Apply this filter to order the events according the date and time when it was created. | [optional] + **starting_after_id** | **str**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] + **start_date** | **datetime**| Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. | [optional] + **end_date** | **datetime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] + **campaign_id** | **str**| Requests only events related to specific campaign identified by its ID. | [optional] + **campaign_type** | [**ParameterCampaignType**](.md)| Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. | [optional] + **category** | [**ParameterActivityCategory**](.md)| Filters activities for actions or effects. Allowed values: ACTION, EFFECT. | [optional] + **type** | **str**| Event name of the customer event. | [optional] + +### Return type + +[**CustomersActivityListResponseBody**](CustomersActivityListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with customer activities. | - | + +[[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) + +# **list_customer_redeemables** +> CustomersRedeemablesListResponseBody list_customer_redeemables(customer_id, limit=limit, order=order, starting_after_id=starting_after_id, filters=filters) + +List Customer's Redeemables + +Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_redeemables_list_response_body import CustomersRedeemablesListResponseBody +from voucherify.models.parameter_filters_list_customer_redeemables import ParameterFiltersListCustomerRedeemables +from voucherify.models.parameter_order_list_redeemables import ParameterOrderListRedeemables +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customer_id = 'customer_id_example' # str | Unique identifier of a customer represented by an internal customer ID or customer source ID. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderListRedeemables() # ParameterOrderListRedeemables | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after_id = 'starting_after_id_example' # str | A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + filters = voucherify.ParameterFiltersListCustomerRedeemables() # ParameterFiltersListCustomerRedeemables | Filters for listing customer redeemables. (optional) + + try: + # List Customer's Redeemables + api_response = api_instance.list_customer_redeemables(customer_id, limit=limit, order=order, starting_after_id=starting_after_id, filters=filters) + print("The response of CustomersApi->list_customer_redeemables:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->list_customer_redeemables: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer_id** | **str**| Unique identifier of a customer represented by an internal customer ID or customer source ID. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderListRedeemables**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after_id** | **str**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] + **filters** | [**ParameterFiltersListCustomerRedeemables**](.md)| Filters for listing customer redeemables. | [optional] + +### Return type + +[**CustomersRedeemablesListResponseBody**](CustomersRedeemablesListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | The method returns redeemable(s) to which the given customer is assigned. | - | + +[[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) + +# **list_customer_segments** +> CustomersSegmentsListResponseBody list_customer_segments(customer_id) + +List Customer's Segments + +Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_segments_list_response_body import CustomersSegmentsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customer_id = 'customer_id_example' # str | Unique identifier of a customer represented by an internal customer ID or customer source ID. + + try: + # List Customer's Segments + api_response = api_instance.list_customer_segments(customer_id) + print("The response of CustomersApi->list_customer_segments:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->list_customer_segments: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer_id** | **str**| Unique identifier of a customer represented by an internal customer ID or customer source ID. | + +### Return type + +[**CustomersSegmentsListResponseBody**](CustomersSegmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | The method returns segment(s) to which the given customer belongs to. | - | + +[[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) + +# **list_customers** +> CustomersListResponseBody list_customers(limit=limit, page=page, email=email, city=city, name=name, segment_id=segment_id, created_at_before=created_at_before, created_at_after=created_at_after, updated_at_before=updated_at_before, updated_at_after=updated_at_after, order=order, starting_after=starting_after) + +List Customers + +Returns a list of customers. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_list_response_body import CustomersListResponseBody +from voucherify.models.parameter_order_list_customers import ParameterOrderListCustomers +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + email = 'email_example' # str | Limit the customers to the ones that have this specific email address. (optional) + city = 'city_example' # str | Limit the customers to the ones that are located in the specified city. (optional) + name = 'name_example' # str | Filter customers by the name property. (optional) + segment_id = 'segment_id_example' # str | Filter customers by the segment id. (optional) + created_at_before = '2013-10-20T19:20:30+01:00' # datetime | Filter customers by date customer was created. (optional) + created_at_after = '2013-10-20T19:20:30+01:00' # datetime | Filter customers by date customer was created. (optional) + updated_at_before = '2013-10-20T19:20:30+01:00' # datetime | Filter customers by date customer was updated last time. (optional) + updated_at_after = '2013-10-20T19:20:30+01:00' # datetime | Filter customers by date customer was updated last time. (optional) + order = voucherify.ParameterOrderListCustomers() # ParameterOrderListCustomers | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after = '2013-10-20T19:20:30+01:00' # datetime | A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) + + try: + # List Customers + api_response = api_instance.list_customers(limit=limit, page=page, email=email, city=city, name=name, segment_id=segment_id, created_at_before=created_at_before, created_at_after=created_at_after, updated_at_before=updated_at_before, updated_at_after=updated_at_after, order=order, starting_after=starting_after) + print("The response of CustomersApi->list_customers:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->list_customers: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **email** | **str**| Limit the customers to the ones that have this specific email address. | [optional] + **city** | **str**| Limit the customers to the ones that are located in the specified city. | [optional] + **name** | **str**| Filter customers by the name property. | [optional] + **segment_id** | **str**| Filter customers by the segment id. | [optional] + **created_at_before** | **datetime**| Filter customers by date customer was created. | [optional] + **created_at_after** | **datetime**| Filter customers by date customer was created. | [optional] + **updated_at_before** | **datetime**| Filter customers by date customer was updated last time. | [optional] + **updated_at_after** | **datetime**| Filter customers by date customer was updated last time. | [optional] + **order** | [**ParameterOrderListCustomers**](.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after** | **datetime**| A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. | [optional] + +### Return type + +[**CustomersListResponseBody**](CustomersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with customer objects. The customers are returned sorted by creation date, with the most recent customers appearing first. | - | + +[[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) + +# **update_customer** +> CustomersUpdateResponseBody update_customer(customer_id, customers_update_request_body=customers_update_request_body) + +Update Customer + +Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_update_request_body import CustomersUpdateRequestBody +from voucherify.models.customers_update_response_body import CustomersUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customer_id = 'customer_id_example' # str | A Voucherify customers id or source_id. + customers_update_request_body = {"name":"Alice McDonald","email":"alice.mdconald@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-01-01","birthday":"2022-01-02"} # CustomersUpdateRequestBody | Specify the parameters to be updated. (optional) + + try: + # Update Customer + api_response = api_instance.update_customer(customer_id, customers_update_request_body=customers_update_request_body) + print("The response of CustomersApi->update_customer:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->update_customer: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer_id** | **str**| A Voucherify customers id or source_id. | + **customers_update_request_body** | [**CustomersUpdateRequestBody**](CustomersUpdateRequestBody.md)| Specify the parameters to be updated. | [optional] + +### Return type + +[**CustomersUpdateResponseBody**](CustomersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a customer object if updates were successful. | - | + +[[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) + +# **update_customers_in_bulk** +> CustomersUpdateInBulkResponseBody update_customers_in_bulk(customers_update_in_bulk_request_body=customers_update_in_bulk_request_body) + +Update Customers in Bulk + +Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_update_in_bulk_request_body import CustomersUpdateInBulkRequestBody +from voucherify.models.customers_update_in_bulk_response_body import CustomersUpdateInBulkResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customers_update_in_bulk_request_body = [{"source_id":"John.Smith@email.com","name":"John Smith","email":"john.smith@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthday":"2022-04-04"},{"source_id":"Jane.Smith@email.com","name":"Jane Smith","email":"Jane.Smith@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthday":"2022-03-03"},{"source_id":"Sally.Smith@email.com","name":"Sally Smith","email":"Sally.Smith@email.com","description":"Updating customer data","phone":"+1 (132) 222-2222","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-02-02"}] # List[CustomersUpdateInBulkRequestBody] | List the customer fields to be updated in each customer object. (optional) + + try: + # Update Customers in Bulk + api_response = api_instance.update_customers_in_bulk(customers_update_in_bulk_request_body=customers_update_in_bulk_request_body) + print("The response of CustomersApi->update_customers_in_bulk:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->update_customers_in_bulk: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customers_update_in_bulk_request_body** | [**List[CustomersUpdateInBulkRequestBody]**](CustomersUpdateInBulkRequestBody.md)| List the customer fields to be updated in each customer object. | [optional] + +### Return type + +[**CustomersUpdateInBulkResponseBody**](CustomersUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action. The response informs you that the request has been accepted and the resources will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and use it as a query parameter in the [GET Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **update_customers_metadata_in_bulk** +> CustomersMetadataUpdateInBulkResponseBody update_customers_metadata_in_bulk(customers_metadata_update_in_bulk_request_body=customers_metadata_update_in_bulk_request_body) + +Update Customers' Metadata in Bulk + +Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.customers_metadata_update_in_bulk_request_body import CustomersMetadataUpdateInBulkRequestBody +from voucherify.models.customers_metadata_update_in_bulk_response_body import CustomersMetadataUpdateInBulkResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.CustomersApi(api_client) + customers_metadata_update_in_bulk_request_body = {"source_ids":["source_123","source_456"],"metadata":{"lang":"en","test":false}} # CustomersMetadataUpdateInBulkRequestBody | List the source_ids of the customers you would like to update with the metadata key/value pairs. (optional) + + try: + # Update Customers' Metadata in Bulk + api_response = api_instance.update_customers_metadata_in_bulk(customers_metadata_update_in_bulk_request_body=customers_metadata_update_in_bulk_request_body) + print("The response of CustomersApi->update_customers_metadata_in_bulk:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomersApi->update_customers_metadata_in_bulk: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customers_metadata_update_in_bulk_request_body** | [**CustomersMetadataUpdateInBulkRequestBody**](CustomersMetadataUpdateInBulkRequestBody.md)| List the source_ids of the customers you would like to update with the metadata key/value pairs. | [optional] + +### Return type + +[**CustomersMetadataUpdateInBulkResponseBody**](CustomersMetadataUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action. The response informs you that the request has been accepted and the resources will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and use it as a query parameter in the [GET Async Action](ref:get-async-action) endpoint. | - | + +[[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) + diff --git a/docs/CustomersCreateRequestBody.md b/docs/CustomersCreateRequestBody.md new file mode 100644 index 00000000..1e863b27 --- /dev/null +++ b/docs/CustomersCreateRequestBody.md @@ -0,0 +1,22 @@ +# CustomersCreateRequestBody + +Request body schema for **POST** `v1/customers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomersCreateRequestBodyAddress**](CustomersCreateRequestBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomersCreateRequestBodyAddress.md b/docs/CustomersCreateRequestBodyAddress.md new file mode 100644 index 00000000..6bc0a7c0 --- /dev/null +++ b/docs/CustomersCreateRequestBodyAddress.md @@ -0,0 +1,18 @@ +# CustomersCreateRequestBodyAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomersCreateResponseBody.md b/docs/CustomersCreateResponseBody.md new file mode 100644 index 00000000..c1476cc8 --- /dev/null +++ b/docs/CustomersCreateResponseBody.md @@ -0,0 +1,30 @@ +# CustomersCreateResponseBody + +Response body for **POST** `v1/customers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] +**system_metadata** | **object** | Object used to store system metadata information. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**CustomersCreateResponseBodyAssets**](CustomersCreateResponseBodyAssets.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomersCreateResponseBodyAddress**](CustomersCreateResponseBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomersCreateResponseBodyAddress.md b/docs/CustomersCreateResponseBodyAddress.md new file mode 100644 index 00000000..3062893f --- /dev/null +++ b/docs/CustomersCreateResponseBodyAddress.md @@ -0,0 +1,18 @@ +# CustomersCreateResponseBodyAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomersCreateResponseBodyAssets.md b/docs/CustomersCreateResponseBodyAssets.md new file mode 100644 index 00000000..12de112a --- /dev/null +++ b/docs/CustomersCreateResponseBodyAssets.md @@ -0,0 +1,13 @@ +# CustomersCreateResponseBodyAssets + +Contains information about the customer's cockpit. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpit_url** | **str** | Customer's cockpit URL address. | [optional] + +[[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/CustomersGetResponseBody.md b/docs/CustomersGetResponseBody.md new file mode 100644 index 00000000..da3d4611 --- /dev/null +++ b/docs/CustomersGetResponseBody.md @@ -0,0 +1,30 @@ +# CustomersGetResponseBody + +Response body schema for **GET** `v1/customers/{customerId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] +**system_metadata** | **object** | Object used to store system metadata information. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**CustomersGetResponseBodyAssets**](CustomersGetResponseBodyAssets.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomersGetResponseBodyAddress**](CustomersGetResponseBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomersGetResponseBodyAddress.md b/docs/CustomersGetResponseBodyAddress.md new file mode 100644 index 00000000..58f5888b --- /dev/null +++ b/docs/CustomersGetResponseBodyAddress.md @@ -0,0 +1,18 @@ +# CustomersGetResponseBodyAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomersGetResponseBodyAssets.md b/docs/CustomersGetResponseBodyAssets.md new file mode 100644 index 00000000..5b6435ed --- /dev/null +++ b/docs/CustomersGetResponseBodyAssets.md @@ -0,0 +1,13 @@ +# CustomersGetResponseBodyAssets + +Contains information about the customer's cockpit. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpit_url** | **str** | Customer's cockpit URL address. | [optional] + +[[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/CustomersImportCsvCreateResponseBody.md b/docs/CustomersImportCsvCreateResponseBody.md new file mode 100644 index 00000000..d127be5a --- /dev/null +++ b/docs/CustomersImportCsvCreateResponseBody.md @@ -0,0 +1,13 @@ +# CustomersImportCsvCreateResponseBody + +Response body schema for **POST** `v1/customers/importCSV`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/CustomersListResponseBody.md b/docs/CustomersListResponseBody.md new file mode 100644 index 00000000..64391d33 --- /dev/null +++ b/docs/CustomersListResponseBody.md @@ -0,0 +1,17 @@ +# CustomersListResponseBody + +Response body schema for **GET** `v1/customers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about customers in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of customer objects. | [optional] [default to 'customers'] +**customers** | [**List[CustomerWithSummaryLoyaltyReferrals]**](CustomerWithSummaryLoyaltyReferrals.md) | Contains array of customer objects. | [optional] +**total** | **int** | Total number of customers. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different end date filter) to get more records returned in the results. | [optional] + +[[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/CustomersMetadataUpdateInBulkRequestBody.md b/docs/CustomersMetadataUpdateInBulkRequestBody.md new file mode 100644 index 00000000..4f5e69e3 --- /dev/null +++ b/docs/CustomersMetadataUpdateInBulkRequestBody.md @@ -0,0 +1,14 @@ +# CustomersMetadataUpdateInBulkRequestBody + +Request body schema for **POST** `v1/customers/metadata/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_ids** | **List[str]** | An array of customer `source_id`'s. | [optional] +**metadata** | **object** | Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomersMetadataUpdateInBulkResponseBody.md b/docs/CustomersMetadataUpdateInBulkResponseBody.md new file mode 100644 index 00000000..73bdfad6 --- /dev/null +++ b/docs/CustomersMetadataUpdateInBulkResponseBody.md @@ -0,0 +1,13 @@ +# CustomersMetadataUpdateInBulkResponseBody + +Response body schema for **POST** `v1/customers/metadata/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/CustomersPermanentDeletionCreateResponseBody.md b/docs/CustomersPermanentDeletionCreateResponseBody.md new file mode 100644 index 00000000..076d30c4 --- /dev/null +++ b/docs/CustomersPermanentDeletionCreateResponseBody.md @@ -0,0 +1,19 @@ +# CustomersPermanentDeletionCreateResponseBody + +Response body schema for **POST** `v1/customers/{customerId}/permanent-deletion`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique permanent deletion object ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format. | [optional] +**related_object_id** | **str** | Unique customer ID that is being deleted. | [optional] +**related_object** | **str** | Object being deleted. | [optional] [default to 'customer'] +**status** | **str** | Deletion status. | [optional] [default to 'DONE'] +**data_json** | [**CustomersPermanentDeletionCreateResponseBodyDataJson**](CustomersPermanentDeletionCreateResponseBodyDataJson.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'pernament_deletion'] + +[[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/CustomersPermanentDeletionCreateResponseBodyDataJson.md b/docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md new file mode 100644 index 00000000..fea747c2 --- /dev/null +++ b/docs/CustomersPermanentDeletionCreateResponseBodyDataJson.md @@ -0,0 +1,19 @@ +# CustomersPermanentDeletionCreateResponseBodyDataJson + +Statistics summarizing the number of related information that was deleted. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**events** | **int** | Number of events deleted. | [optional] +**customer_events** | **int** | Number of customer events deleted. | [optional] +**daily_events** | **int** | Number of daily events deleted. | [optional] +**segments** | **int** | Number of segments deleted. | [optional] +**orders** | **int** | Number of orders deleted. | [optional] +**order_events** | **int** | Number of order events deleted. | [optional] +**customer** | **int** | Number of customers deleted. | [optional] [default to 1] + +[[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/CustomersRedeemablesListResponseBody.md b/docs/CustomersRedeemablesListResponseBody.md new file mode 100644 index 00000000..abc1c1c6 --- /dev/null +++ b/docs/CustomersRedeemablesListResponseBody.md @@ -0,0 +1,18 @@ +# CustomersRedeemablesListResponseBody + +Response body schema for **GET** `v1/customers/{customerId}/redeemables`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about customer redeemables. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of redeemables. | [optional] [default to 'data'] +**data** | [**List[CustomerRedeemable]**](CustomerRedeemable.md) | A dictionary that contains an array of redeemables. | [optional] +**total** | **int** | Total number of results returned. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] +**more_starting_after** | **str** | Returns an ID that can be used to return another page of results. Use the ID in the `starting_after_id` query parameter to display another page of the results occuring after the field with that ID. | [optional] + +[[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/CustomersSegmentsListResponseBody.md b/docs/CustomersSegmentsListResponseBody.md new file mode 100644 index 00000000..5c23a916 --- /dev/null +++ b/docs/CustomersSegmentsListResponseBody.md @@ -0,0 +1,16 @@ +# CustomersSegmentsListResponseBody + +Response body schema for **GET** `v1/customers/{customerId}/segments`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about customer segments. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of segment IDs. | [optional] [default to 'data'] +**data** | [**List[SimpleSegment]**](SimpleSegment.md) | A dictionary that contains an array of segment IDs and names. | [optional] +**total** | **int** | Total number of segments the customer belongs to. | [optional] + +[[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/CustomersUpdateInBulkRequestBody.md b/docs/CustomersUpdateInBulkRequestBody.md new file mode 100644 index 00000000..436fb856 --- /dev/null +++ b/docs/CustomersUpdateInBulkRequestBody.md @@ -0,0 +1,21 @@ +# CustomersUpdateInBulkRequestBody + +Request body schema for **POST** `v1/customers/bulk/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_id** | **str** | Unique customer source ID. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomersUpdateInBulkRequestBodyAddress**](CustomersUpdateInBulkRequestBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomersUpdateInBulkRequestBodyAddress.md b/docs/CustomersUpdateInBulkRequestBodyAddress.md new file mode 100644 index 00000000..fe5bd92c --- /dev/null +++ b/docs/CustomersUpdateInBulkRequestBodyAddress.md @@ -0,0 +1,18 @@ +# CustomersUpdateInBulkRequestBodyAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomersUpdateInBulkResponseBody.md b/docs/CustomersUpdateInBulkResponseBody.md new file mode 100644 index 00000000..3e6a3754 --- /dev/null +++ b/docs/CustomersUpdateInBulkResponseBody.md @@ -0,0 +1,13 @@ +# CustomersUpdateInBulkResponseBody + +Response body schema for **POST** `v1/customers/bulk/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/CustomersUpdateRequestBody.md b/docs/CustomersUpdateRequestBody.md new file mode 100644 index 00000000..e8f49a5a --- /dev/null +++ b/docs/CustomersUpdateRequestBody.md @@ -0,0 +1,20 @@ +# CustomersUpdateRequestBody + +Request body schema for **PUT** `v1/customers/{customerId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomersUpdateRequestBodyAddress**](CustomersUpdateRequestBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomersUpdateRequestBodyAddress.md b/docs/CustomersUpdateRequestBodyAddress.md new file mode 100644 index 00000000..a94b3575 --- /dev/null +++ b/docs/CustomersUpdateRequestBodyAddress.md @@ -0,0 +1,18 @@ +# CustomersUpdateRequestBodyAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomersUpdateResponseBody.md b/docs/CustomersUpdateResponseBody.md new file mode 100644 index 00000000..ae4d8ed8 --- /dev/null +++ b/docs/CustomersUpdateResponseBody.md @@ -0,0 +1,30 @@ +# CustomersUpdateResponseBody + +Response body schema for **PUT** `v1/customers/{customerId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer that will be linked to redemption in this request. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**summary** | [**CustomerSummary**](CustomerSummary.md) | | [optional] +**loyalty** | [**CustomerLoyalty**](CustomerLoyalty.md) | | [optional] +**referrals** | [**CustomerReferrals**](CustomerReferrals.md) | | [optional] +**system_metadata** | **object** | Object used to store system metadata information. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format. | [optional] +**assets** | [**CustomersUpdateResponseBodyAssets**](CustomersUpdateResponseBodyAssets.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**CustomersUpdateResponseBodyAddress**](CustomersUpdateResponseBodyAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/CustomersUpdateResponseBodyAddress.md b/docs/CustomersUpdateResponseBodyAddress.md new file mode 100644 index 00000000..9bd4209d --- /dev/null +++ b/docs/CustomersUpdateResponseBodyAddress.md @@ -0,0 +1,18 @@ +# CustomersUpdateResponseBodyAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/CustomersUpdateResponseBodyAssets.md b/docs/CustomersUpdateResponseBodyAssets.md new file mode 100644 index 00000000..2835fcfb --- /dev/null +++ b/docs/CustomersUpdateResponseBodyAssets.md @@ -0,0 +1,13 @@ +# CustomersUpdateResponseBodyAssets + +Contains information about the customer's cockpit. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cockpit_url** | **str** | Customer's cockpit URL address. | [optional] + +[[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/Discount.md b/docs/Discount.md new file mode 100644 index 00000000..48d7d439 --- /dev/null +++ b/docs/Discount.md @@ -0,0 +1,28 @@ +# Discount + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**amount_off** | **float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] +**amount_off_formula** | **str** | | [optional] +**aggregated_amount_limit** | **int** | Maximum discount amount per order. | [optional] +**effect** | **str** | | [optional] +**is_dynamic** | **bool** | Flag indicating whether the discount was calculated using a formula. | [optional] +**unit_off** | **int** | Number of units to be granted a full value discount. | [optional] +**unit_off_formula** | **str** | | [optional] +**unit_type** | **str** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**SimpleProductDiscountUnit**](SimpleProductDiscountUnit.md) | | [optional] +**sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] +**units** | [**List[DiscountUnitMultipleOneUnit]**](DiscountUnitMultipleOneUnit.md) | | [optional] +**percent_off** | **float** | The percent discount that the customer will receive. | [optional] +**percent_off_formula** | **str** | | [optional] +**amount_limit** | **float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**fixed_amount** | **float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] +**fixed_amount_formula** | **str** | | [optional] + +[[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/DiscountUnitMultipleOneUnit.md b/docs/DiscountUnitMultipleOneUnit.md new file mode 100644 index 00000000..76c556cb --- /dev/null +++ b/docs/DiscountUnitMultipleOneUnit.md @@ -0,0 +1,17 @@ +# DiscountUnitMultipleOneUnit + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**unit_off** | **float** | Number of units to be granted a full value discount. | [optional] +**unit_off_formula** | **str** | | [optional] +**effect** | **str** | Defines how the unit is added to the customer's order. | [optional] +**unit_type** | **str** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**SimpleProductDiscountUnit**](SimpleProductDiscountUnit.md) | | [optional] +**sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] + +[[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/EarningRule.md b/docs/EarningRule.md new file mode 100644 index 00000000..37071ee0 --- /dev/null +++ b/docs/EarningRule.md @@ -0,0 +1,30 @@ +# EarningRule + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**EarningRuleLoyalty**](EarningRuleLoyalty.md) | | [optional] +**event** | **str** | | [optional] +**custom_event** | [**EarningRuleCustomEvent**](EarningRuleCustomEvent.md) | | [optional] +**segment** | [**EarningRuleSegment**](EarningRuleSegment.md) | | [optional] +**loyalty_tier** | [**EarningRuleLoyaltyTier**](EarningRuleLoyaltyTier.md) | | [optional] +**source** | [**EarningRuleSource**](EarningRuleSource.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automation_id** | **str** | For internal use by Voucherify. | [optional] +**start_date** | **str** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expiration_date** | **str** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[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/EarningRuleCustomEvent.md b/docs/EarningRuleCustomEvent.md new file mode 100644 index 00000000..08cfe2e1 --- /dev/null +++ b/docs/EarningRuleCustomEvent.md @@ -0,0 +1,13 @@ +# EarningRuleCustomEvent + +Contains details about the custom event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **str** | Unique identifier of the custom event schema | [optional] + +[[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/EarningRuleLoyalty.md b/docs/EarningRuleLoyalty.md new file mode 100644 index 00000000..f0297dd3 --- /dev/null +++ b/docs/EarningRuleLoyalty.md @@ -0,0 +1,18 @@ +# EarningRuleLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**calculation_type** | **str** | | [optional] +**order** | [**EarningRuleLoyaltyOrder**](EarningRuleLoyaltyOrder.md) | | [optional] +**order_items** | [**EarningRuleLoyaltyOrderItems**](EarningRuleLoyaltyOrderItems.md) | | [optional] +**customer** | [**EarningRuleLoyaltyCustomer**](EarningRuleLoyaltyCustomer.md) | | [optional] +**custom_event** | [**EarningRuleLoyaltyCustomEvent**](EarningRuleLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[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/EarningRuleLoyaltyCustomEvent.md b/docs/EarningRuleLoyaltyCustomEvent.md new file mode 100644 index 00000000..72ce9e6b --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# EarningRuleLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**EarningRuleLoyaltyCustomEventMetadata**](EarningRuleLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/EarningRuleLoyaltyCustomEventMetadata.md b/docs/EarningRuleLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..3bfc597f --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# EarningRuleLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/EarningRuleLoyaltyCustomer.md b/docs/EarningRuleLoyaltyCustomer.md new file mode 100644 index 00000000..d5eed072 --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# EarningRuleLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**EarningRuleLoyaltyCustomerMetadata**](EarningRuleLoyaltyCustomerMetadata.md) | | [optional] + +[[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/EarningRuleLoyaltyCustomerMetadata.md b/docs/EarningRuleLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..1b58c54c --- /dev/null +++ b/docs/EarningRuleLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# EarningRuleLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/EarningRuleLoyaltyOrder.md b/docs/EarningRuleLoyaltyOrder.md new file mode 100644 index 00000000..2a02deaf --- /dev/null +++ b/docs/EarningRuleLoyaltyOrder.md @@ -0,0 +1,14 @@ +# EarningRuleLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**EarningRuleLoyaltyOrderAmount**](EarningRuleLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**EarningRuleLoyaltyOrderTotalAmount**](EarningRuleLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**EarningRuleLoyaltyOrderMetadata**](EarningRuleLoyaltyOrderMetadata.md) | | [optional] + +[[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/EarningRuleLoyaltyOrderAmount.md b/docs/EarningRuleLoyaltyOrderAmount.md new file mode 100644 index 00000000..8a5efb68 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# EarningRuleLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/EarningRuleLoyaltyOrderItems.md b/docs/EarningRuleLoyaltyOrderItems.md new file mode 100644 index 00000000..7afb0959 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# EarningRuleLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**EarningRuleLoyaltyOrderItemsQuantity**](EarningRuleLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**EarningRuleLoyaltyOrderItemsAmount**](EarningRuleLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**EarningRuleLoyaltyOrderItemsSubtotalAmount**](EarningRuleLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/EarningRuleLoyaltyOrderItemsAmount.md b/docs/EarningRuleLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..a75f36f0 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# EarningRuleLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/EarningRuleLoyaltyOrderItemsQuantity.md b/docs/EarningRuleLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..80e5189c --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# EarningRuleLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/EarningRuleLoyaltyOrderItemsSubtotalAmount.md b/docs/EarningRuleLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..cdb2632d --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# EarningRuleLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/EarningRuleLoyaltyOrderMetadata.md b/docs/EarningRuleLoyaltyOrderMetadata.md new file mode 100644 index 00000000..ab4b222f --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# EarningRuleLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/EarningRuleLoyaltyOrderTotalAmount.md b/docs/EarningRuleLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..f30a57d7 --- /dev/null +++ b/docs/EarningRuleLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# EarningRuleLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/EarningRuleLoyaltyTier.md b/docs/EarningRuleLoyaltyTier.md new file mode 100644 index 00000000..7a02208e --- /dev/null +++ b/docs/EarningRuleLoyaltyTier.md @@ -0,0 +1,13 @@ +# EarningRuleLoyaltyTier + +Defines the tier associated with the earning rule definition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] + +[[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/EarningRuleSegment.md b/docs/EarningRuleSegment.md new file mode 100644 index 00000000..db3deaab --- /dev/null +++ b/docs/EarningRuleSegment.md @@ -0,0 +1,13 @@ +# EarningRuleSegment + +Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] + +[[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/EarningRuleSource.md b/docs/EarningRuleSource.md new file mode 100644 index 00000000..eacddb7a --- /dev/null +++ b/docs/EarningRuleSource.md @@ -0,0 +1,15 @@ +# EarningRuleSource + +Contains the custom earning rule name and parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**object_id** | **str** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**object_type** | **str** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[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/Error.md b/docs/Error.md new file mode 100644 index 00000000..2a66a35f --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,19 @@ +# Error + +Error details + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | Error's HTTP status code. | [optional] +**key** | **str** | Short string describing the kind of error which occurred. | [optional] +**message** | **str** | A human-readable message providing a short description of the error. | [optional] +**details** | **str** | A human-readable message providing more details about the error. | [optional] +**request_id** | **str** | This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team. | [optional] +**resource_id** | **str** | Unique resource ID that can be used in another endpoint to get more details. | [optional] +**resource_type** | **str** | The resource type. | [optional] + +[[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/EventsApi.md b/docs/EventsApi.md new file mode 100644 index 00000000..bd718551 --- /dev/null +++ b/docs/EventsApi.md @@ -0,0 +1,96 @@ +# voucherify.EventsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**track_custom_event**](EventsApi.md#track_custom_event) | **POST** /v1/events | Track Custom Event + + +# **track_custom_event** +> EventsCreateResponseBody track_custom_event(events_create_request_body=events_create_request_body) + +Track Custom Event + +To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.events_create_request_body import EventsCreateRequestBody +from voucherify.models.events_create_response_body import EventsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.EventsApi(api_client) + events_create_request_body = {"event":"event-name","customer":{"source_id":"referee-source_id"},"referral":{"code":"voucher-code","referrer_id":"referrer-source_id"}} # EventsCreateRequestBody | Specify the details of the custom event. (optional) + + try: + # Track Custom Event + api_response = api_instance.track_custom_event(events_create_request_body=events_create_request_body) + print("The response of EventsApi->track_custom_event:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EventsApi->track_custom_event: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **events_create_request_body** | [**EventsCreateRequestBody**](EventsCreateRequestBody.md)| Specify the details of the custom event. | [optional] + +### Return type + +[**EventsCreateResponseBody**](EventsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the event type if the event was received by the application. | - | + +[[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) + diff --git a/docs/EventsCreateRequestBody.md b/docs/EventsCreateRequestBody.md new file mode 100644 index 00000000..72302417 --- /dev/null +++ b/docs/EventsCreateRequestBody.md @@ -0,0 +1,17 @@ +# EventsCreateRequestBody + +Request body schema for **POST** `v1/events`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event** | **str** | Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**. | [optional] +**customer** | [**Customer**](Customer.md) | | +**referral** | [**EventsCreateRequestBodyReferral**](EventsCreateRequestBodyReferral.md) | | [optional] +**loyalty** | [**EventsCreateRequestBodyLoyalty**](EventsCreateRequestBodyLoyalty.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**. | [optional] + +[[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/EventsCreateRequestBodyLoyalty.md b/docs/EventsCreateRequestBodyLoyalty.md new file mode 100644 index 00000000..6ea15c63 --- /dev/null +++ b/docs/EventsCreateRequestBodyLoyalty.md @@ -0,0 +1,13 @@ +# EventsCreateRequestBodyLoyalty + +If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code. | [optional] + +[[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/EventsCreateRequestBodyReferral.md b/docs/EventsCreateRequestBodyReferral.md new file mode 100644 index 00000000..bc94d45e --- /dev/null +++ b/docs/EventsCreateRequestBodyReferral.md @@ -0,0 +1,14 @@ +# EventsCreateRequestBodyReferral + +If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | A code through which a new visitor has been referred to a service. | [optional] +**referrer_id** | **str** | Unique ID of the referring person - it is optional and not required if the referral **code** is provided. | [optional] + +[[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/EventsCreateResponseBody.md b/docs/EventsCreateResponseBody.md new file mode 100644 index 00000000..e802fc14 --- /dev/null +++ b/docs/EventsCreateResponseBody.md @@ -0,0 +1,18 @@ +# EventsCreateResponseBody + +Response body schema for **POST** `v1/events`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The object represented is an `event`. | [optional] [default to 'event'] +**type** | **str** | The event name. | [optional] +**customer** | [**SimpleCustomerRequiredObjectType**](SimpleCustomerRequiredObjectType.md) | | +**referral** | **object** | A `null` referral object. | [optional] +**loyalty** | **object** | A `null` loyalty object. | [optional] +**metadata** | **object** | | [optional] + +[[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/Export.md b/docs/Export.md new file mode 100644 index 00000000..686d1f62 --- /dev/null +++ b/docs/Export.md @@ -0,0 +1,20 @@ +# Export + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique export ID. | [optional] +**object** | **str** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**created_at** | **datetime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **str** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] +**channel** | **str** | The channel through which the export was triggered. | [optional] +**result** | [**ExportResult**](ExportResult.md) | | [optional] +**user_id** | **str** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exported_object** | **str** | | [optional] +**parameters** | [**ExportParameters**](ExportParameters.md) | | [optional] + +[[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/ExportOrderFields.md b/docs/ExportOrderFields.md new file mode 100644 index 00000000..7a34a113 --- /dev/null +++ b/docs/ExportOrderFields.md @@ -0,0 +1,34 @@ +# ExportOrderFields + + +## Enum + +* `ID` (value: `'id'`) + +* `SOURCE_ID` (value: `'source_id'`) + +* `CREATED_AT` (value: `'created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `STATUS` (value: `'status'`) + +* `AMOUNT` (value: `'amount'`) + +* `DISCOUNT_AMOUNT` (value: `'discount_amount'`) + +* `ITEMS_DISCOUNT_AMOUNT` (value: `'items_discount_amount'`) + +* `TOTAL_DISCOUNT_AMOUNT` (value: `'total_discount_amount'`) + +* `TOTAL_AMOUNT` (value: `'total_amount'`) + +* `CUSTOMER_ID` (value: `'customer_id'`) + +* `REFERRER_ID` (value: `'referrer_id'`) + +* `METADATA` (value: `'metadata'`) + +[[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/ExportOrderOrder.md b/docs/ExportOrderOrder.md new file mode 100644 index 00000000..db5a2d0e --- /dev/null +++ b/docs/ExportOrderOrder.md @@ -0,0 +1,20 @@ +# ExportOrderOrder + + +## Enum + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_STATUS` (value: `'-status'`) + +* `STATUS` (value: `'status'`) + +[[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/ExportParameters.md b/docs/ExportParameters.md new file mode 100644 index 00000000..90a217bd --- /dev/null +++ b/docs/ExportParameters.md @@ -0,0 +1,14 @@ +# ExportParameters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | | [optional] +**fields** | **List[str]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**ExportParametersFilters**](ExportParametersFilters.md) | | [optional] + +[[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/ExportParametersFilters.md b/docs/ExportParametersFilters.md new file mode 100644 index 00000000..5590f1f9 --- /dev/null +++ b/docs/ExportParametersFilters.md @@ -0,0 +1,15 @@ +# ExportParametersFilters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ExportResult.md b/docs/ExportResult.md new file mode 100644 index 00000000..995835a5 --- /dev/null +++ b/docs/ExportResult.md @@ -0,0 +1,12 @@ +# ExportResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **str** | URL of the CSV file location. It contains the token used for authorization in the Download export method. | [optional] + +[[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/ExportVoucherTransactionsFields.md b/docs/ExportVoucherTransactionsFields.md new file mode 100644 index 00000000..e48505e8 --- /dev/null +++ b/docs/ExportVoucherTransactionsFields.md @@ -0,0 +1,32 @@ +# ExportVoucherTransactionsFields + + +## Enum + +* `ID` (value: `'id'`) + +* `CAMPAIGN_ID` (value: `'campaign_id'`) + +* `VOUCHER_ID` (value: `'voucher_id'`) + +* `TYPE` (value: `'type'`) + +* `SOURCE_ID` (value: `'source_id'`) + +* `REASON` (value: `'reason'`) + +* `SOURCE` (value: `'source'`) + +* `BALANCE` (value: `'balance'`) + +* `AMOUNT` (value: `'amount'`) + +* `RELATED_TRANSACTION_ID` (value: `'related_transaction_id'`) + +* `CREATED_AT` (value: `'created_at'`) + +* `DETAILS` (value: `'details'`) + +[[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/ExportVoucherTransactionsFilters.md b/docs/ExportVoucherTransactionsFilters.md new file mode 100644 index 00000000..b00b60cb --- /dev/null +++ b/docs/ExportVoucherTransactionsFilters.md @@ -0,0 +1,15 @@ +# ExportVoucherTransactionsFilters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] +**voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ExportVoucherTransactionsOrder.md b/docs/ExportVoucherTransactionsOrder.md new file mode 100644 index 00000000..7cef1248 --- /dev/null +++ b/docs/ExportVoucherTransactionsOrder.md @@ -0,0 +1,12 @@ +# ExportVoucherTransactionsOrder + + +## Enum + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `CREATED_AT` (value: `'created_at'`) + +[[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/ExportsApi.md b/docs/ExportsApi.md new file mode 100644 index 00000000..90bff872 --- /dev/null +++ b/docs/ExportsApi.md @@ -0,0 +1,429 @@ +# voucherify.ExportsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_export**](ExportsApi.md#create_export) | **POST** /v1/exports | Create Export +[**delete_export**](ExportsApi.md#delete_export) | **DELETE** /v1/exports/{exportId} | Delete Export +[**download_export**](ExportsApi.md#download_export) | **GET** /v1/exports/{export_Id} | Download Export +[**get_export**](ExportsApi.md#get_export) | **GET** /v1/exports/{exportId} | Get Export +[**list_exports**](ExportsApi.md#list_exports) | **GET** /v1/exports | List Exports + + +# **create_export** +> ExportsCreateResponseBody create_export(exports_create_request_body=exports_create_request_body) + +Create Export + +Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.exports_create_request_body import ExportsCreateRequestBody +from voucherify.models.exports_create_response_body import ExportsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ExportsApi(api_client) + exports_create_request_body = voucherify.ExportsCreateRequestBody() # ExportsCreateRequestBody | Specify the details of the export that you would like to create. (optional) + + try: + # Create Export + api_response = api_instance.create_export(exports_create_request_body=exports_create_request_body) + print("The response of ExportsApi->create_export:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ExportsApi->create_export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **exports_create_request_body** | [**ExportsCreateRequestBody**](ExportsCreateRequestBody.md)| Specify the details of the export that you would like to create. | [optional] + +### Return type + +[**ExportsCreateResponseBody**](ExportsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns export object and URL of CSV file. | - | + +[[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) + +# **delete_export** +> delete_export(export_id) + +Delete Export + +This method deletes a previously created export object. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ExportsApi(api_client) + export_id = 'export_id_example' # str | Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. + + try: + # Delete Export + api_instance.delete_export(export_id) + except Exception as e: + print("Exception when calling ExportsApi->delete_export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **export_id** | **str**| Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **download_export** +> str download_export(export_id, token=token) + +Download Export + +Download the contents of the exported CSV file. ๐Ÿ“˜ Important notes **Base URL:** - https://download.voucherify.io (Europe) - https://us1.download.voucherify.io (US) - https://as1.download.voucherify.io (Asia) **Token:** Can be found within the result parameter of the Get Export method response. + +### Example + + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ExportsApi(api_client) + export_id = 'exp_ex6zq0x0EEa9S0N68QcqhxcQ' # str | Unique export object ID. + token = 'token_example' # str | Token that was issued to the export, to get this token, get the export first (optional) + + try: + # Download Export + api_response = api_instance.download_export(export_id, token=token) + print("The response of ExportsApi->download_export:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ExportsApi->download_export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **export_id** | **str**| Unique export object ID. | + **token** | **str**| Token that was issued to the export, to get this token, get the export first | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns contents of CSV file. | - | + +[[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) + +# **get_export** +> ExportsGetResponseBody get_export(export_id) + +Get Export + +Retrieves the URL of the downloadable file, which was generated via the Create Export method. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.exports_get_response_body import ExportsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ExportsApi(api_client) + export_id = 'export_id_example' # str | Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. + + try: + # Get Export + api_response = api_instance.get_export(export_id) + print("The response of ExportsApi->get_export:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ExportsApi->get_export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **export_id** | **str**| Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. | + +### Return type + +[**ExportsGetResponseBody**](ExportsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the export object if a valid identifier was provided in the path. | - | + +[[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) + +# **list_exports** +> ExportsListResponseBody list_exports(limit=limit, page=page, order=order) + +List Exports + +List all exports. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.exports_list_response_body import ExportsListResponseBody +from voucherify.models.parameter_order_list_exports import ParameterOrderListExports +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ExportsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListExports() # ParameterOrderListExports | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Exports + api_response = api_instance.list_exports(limit=limit, page=page, order=order) + print("The response of ExportsApi->list_exports:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ExportsApi->list_exports: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListExports**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**ExportsListResponseBody**](ExportsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | A dictionary with an exports property that contains an array of exports. Each entry in the array is a separate export object. The list will return the following types of exported objects: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. The `channel` parameter in the response body returns the channel that was used to generate the particular export. The `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`. | - | + +[[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) + diff --git a/docs/ExportsCreateRequestBody.md b/docs/ExportsCreateRequestBody.md new file mode 100644 index 00000000..49cf251c --- /dev/null +++ b/docs/ExportsCreateRequestBody.md @@ -0,0 +1,13 @@ +# ExportsCreateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exported_object** | **str** | | [optional] +**parameters** | [**ExportsCreateRequestBodyParameters**](ExportsCreateRequestBodyParameters.md) | | [optional] + +[[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/ExportsCreateRequestBodyParameters.md b/docs/ExportsCreateRequestBodyParameters.md new file mode 100644 index 00000000..1949033d --- /dev/null +++ b/docs/ExportsCreateRequestBodyParameters.md @@ -0,0 +1,14 @@ +# ExportsCreateRequestBodyParameters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | | [optional] +**fields** | **List[str]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**ExportsCreateRequestBodyParametersFilters**](ExportsCreateRequestBodyParametersFilters.md) | | [optional] + +[[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/ExportsCreateRequestBodyParametersFilters.md b/docs/ExportsCreateRequestBodyParametersFilters.md new file mode 100644 index 00000000..48db664e --- /dev/null +++ b/docs/ExportsCreateRequestBodyParametersFilters.md @@ -0,0 +1,15 @@ +# ExportsCreateRequestBodyParametersFilters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ExportsCreateResponseBody.md b/docs/ExportsCreateResponseBody.md new file mode 100644 index 00000000..66c6e876 --- /dev/null +++ b/docs/ExportsCreateResponseBody.md @@ -0,0 +1,20 @@ +# ExportsCreateResponseBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique export ID. | [optional] +**object** | **str** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**created_at** | **datetime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **str** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **str** | The channel through which the export was triggered. | [optional] +**result** | **object** | Contains the URL of the CSV file. | [optional] +**user_id** | **str** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exported_object** | **str** | | [optional] +**parameters** | [**ExportsCreateResponseBodyParameters**](ExportsCreateResponseBodyParameters.md) | | [optional] + +[[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/ExportsCreateResponseBodyParameters.md b/docs/ExportsCreateResponseBodyParameters.md new file mode 100644 index 00000000..1e7e3eea --- /dev/null +++ b/docs/ExportsCreateResponseBodyParameters.md @@ -0,0 +1,14 @@ +# ExportsCreateResponseBodyParameters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | | [optional] +**fields** | **List[str]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**ExportsCreateResponseBodyParametersFilters**](ExportsCreateResponseBodyParametersFilters.md) | | [optional] + +[[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/ExportsCreateResponseBodyParametersFilters.md b/docs/ExportsCreateResponseBodyParametersFilters.md new file mode 100644 index 00000000..dd1862fd --- /dev/null +++ b/docs/ExportsCreateResponseBodyParametersFilters.md @@ -0,0 +1,15 @@ +# ExportsCreateResponseBodyParametersFilters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ExportsGetResponseBody.md b/docs/ExportsGetResponseBody.md new file mode 100644 index 00000000..a4ef00d3 --- /dev/null +++ b/docs/ExportsGetResponseBody.md @@ -0,0 +1,21 @@ +# ExportsGetResponseBody + +Response body schema for **GET** `v1/exports/{exportId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique export ID. | [optional] +**object** | **str** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**created_at** | **datetime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **str** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] +**channel** | **str** | The channel through which the export was triggered. | [optional] +**result** | [**ExportsGetResponseBodyResult**](ExportsGetResponseBodyResult.md) | | [optional] +**user_id** | **str** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exported_object** | **str** | | [optional] +**parameters** | [**ExportsGetResponseBodyParameters**](ExportsGetResponseBodyParameters.md) | | [optional] + +[[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/ExportsGetResponseBodyParameters.md b/docs/ExportsGetResponseBodyParameters.md new file mode 100644 index 00000000..eb9a6027 --- /dev/null +++ b/docs/ExportsGetResponseBodyParameters.md @@ -0,0 +1,14 @@ +# ExportsGetResponseBodyParameters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | | [optional] +**fields** | **List[str]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**ExportsGetResponseBodyParametersFilters**](ExportsGetResponseBodyParametersFilters.md) | | [optional] + +[[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/ExportsGetResponseBodyParametersFilters.md b/docs/ExportsGetResponseBodyParametersFilters.md new file mode 100644 index 00000000..e46868c1 --- /dev/null +++ b/docs/ExportsGetResponseBodyParametersFilters.md @@ -0,0 +1,15 @@ +# ExportsGetResponseBodyParametersFilters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**campaign_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**voucher_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ExportsGetResponseBodyResult.md b/docs/ExportsGetResponseBodyResult.md new file mode 100644 index 00000000..43ec01a2 --- /dev/null +++ b/docs/ExportsGetResponseBodyResult.md @@ -0,0 +1,12 @@ +# ExportsGetResponseBodyResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **str** | URL of the CSV file location. It contains the token used for authorization in the Download export method. | [optional] + +[[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/ExportsListResponseBody.md b/docs/ExportsListResponseBody.md new file mode 100644 index 00000000..d0a48d35 --- /dev/null +++ b/docs/ExportsListResponseBody.md @@ -0,0 +1,16 @@ +# ExportsListResponseBody + +Response body schema for **GET** `v1/exports`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about exports. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of exports. | [optional] [default to 'exports'] +**exports** | [**List[Export]**](Export.md) | An array of export objects. | [optional] +**total** | **int** | Total number of exports. | [optional] + +[[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/FieldConditions.md b/docs/FieldConditions.md new file mode 100644 index 00000000..7b200fe3 --- /dev/null +++ b/docs/FieldConditions.md @@ -0,0 +1,12 @@ +# FieldConditions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FiltersCondition**](FiltersCondition.md) | | [optional] + +[[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/FilterConditionsString.md b/docs/FilterConditionsString.md new file mode 100644 index 00000000..ce20015d --- /dev/null +++ b/docs/FilterConditionsString.md @@ -0,0 +1,20 @@ +# FilterConditionsString + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**not_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**var_is** | **str** | Value is exactly this value (single value). | [optional] +**is_not** | **str** | Results omit this value (single value). | [optional] +**has_value** | **str** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**is_unknown** | **str** | Value is null. The value for this parameter is an empty string. | [optional] +**starts_with** | **str** | Value starts with the specified string. | [optional] +**ends_with** | **str** | Value ends with the specified string. | [optional] + +[[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/FiltersCondition.md b/docs/FiltersCondition.md new file mode 100644 index 00000000..e506330d --- /dev/null +++ b/docs/FiltersCondition.md @@ -0,0 +1,36 @@ +# FiltersCondition + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **object** | | [optional] +**not_in** | **object** | | [optional] +**var_is** | **object** | | [optional] +**is_days_ago** | **object** | | [optional] +**is_days_in_future** | **object** | | [optional] +**is_not** | **object** | | [optional] +**has_value** | **object** | | [optional] +**is_unknown** | **object** | | [optional] +**contains** | **object** | | [optional] +**not_contain** | **object** | | [optional] +**starts_with** | **object** | | [optional] +**ends_with** | **object** | | [optional] +**more_than** | **object** | | [optional] +**less_than** | **object** | | [optional] +**more_than_ago** | **object** | | [optional] +**less_than_ago** | **object** | | [optional] +**more_than_future** | **object** | | [optional] +**less_than_future** | **object** | | [optional] +**more_than_equal** | **object** | | [optional] +**less_than_equal** | **object** | | [optional] +**after** | **object** | | [optional] +**before** | **object** | | [optional] +**count** | **object** | | [optional] +**count_less** | **object** | | [optional] +**count_more** | **object** | | [optional] + +[[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/Gift.md b/docs/Gift.md new file mode 100644 index 00000000..473872fb --- /dev/null +++ b/docs/Gift.md @@ -0,0 +1,15 @@ +# Gift + +Contains current gift card balance information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **float** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **float** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/InapplicableTo.md b/docs/InapplicableTo.md new file mode 100644 index 00000000..09628cae --- /dev/null +++ b/docs/InapplicableTo.md @@ -0,0 +1,28 @@ +# InapplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | This object stores information about the resource to which the discount is applicable. | [optional] +**id** | **str** | Unique product collection, product, or SKU identifier assigned by Voucherify. | [optional] +**source_id** | **str** | The source identifier from your inventory system. | [optional] +**product_id** | **str** | Parent product's unique ID assigned by Voucherify. | [optional] +**product_source_id** | **str** | Parent product's source ID from your inventory system. | [optional] +**strict** | **bool** | | [optional] +**price** | **float** | New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price. | [optional] +**price_formula** | **float** | Formula used to calculate the discounted price of an item. | [optional] +**effect** | [**ApplicableToEffect**](ApplicableToEffect.md) | | +**quantity_limit** | **int** | The maximum number of units allowed to be discounted per order line item. | [optional] +**aggregated_quantity_limit** | **int** | The maximum number of units allowed to be discounted combined across all matched order line items. | [optional] +**amount_limit** | **int** | Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**aggregated_amount_limit** | **int** | Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value) | [optional] +**order_item_indices** | **List[int]** | Determines the order in which the discount is applied to the products or SKUs sent in the `order` object in the request. The counting begins from `0`. | [optional] +**repeat** | **int** | Determines the recurrence of the discount, e.g. `\"repeat\": 3` means that the discount is applied to every third item. | [optional] +**skip_initially** | **int** | Determines how many items are skipped before the discount is applied. | [optional] +**target** | **str** | Determines to which kinds of objects the discount is applicable. `\"ITEM\"` includes products and SKUs. | [optional] + +[[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/InapplicableToResultList.md b/docs/InapplicableToResultList.md new file mode 100644 index 00000000..e78ceb3f --- /dev/null +++ b/docs/InapplicableToResultList.md @@ -0,0 +1,15 @@ +# InapplicableToResultList + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**List[InapplicableTo]**](InapplicableTo.md) | Contains array of items to which the discount cannot apply. | [optional] +**total** | **int** | Total number of objects defining included products, SKUs, or product collections. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'list'] +**data_ref** | **str** | The type of the object represented by JSON. | [optional] [default to 'data'] + +[[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/Junction.md b/docs/Junction.md new file mode 100644 index 00000000..d1532c1e --- /dev/null +++ b/docs/Junction.md @@ -0,0 +1,13 @@ +# Junction + +Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + +## Enum + +* `AND` (value: `'and'`) + +* `OR` (value: `'or'`) + +[[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/ListPublicationsItemVoucher.md b/docs/ListPublicationsItemVoucher.md new file mode 100644 index 00000000..af49c06b --- /dev/null +++ b/docs/ListPublicationsItemVoucher.md @@ -0,0 +1,18 @@ +# ListPublicationsItemVoucher + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Voucher code. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'voucher'] +**campaign** | **str** | Campaign name | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**loyalty_card** | **object** | Defines the loyalty card details. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] + +[[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/LoyaltiesApi.md b/docs/LoyaltiesApi.md new file mode 100644 index 00000000..09a05beb --- /dev/null +++ b/docs/LoyaltiesApi.md @@ -0,0 +1,4006 @@ +# voucherify.LoyaltiesApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_member**](LoyaltiesApi.md#add_member) | **POST** /v1/loyalties/{campaignId}/members | Add Member +[**create_earning_rule**](LoyaltiesApi.md#create_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules | Create Earning Rule +[**create_in_bulk_loyalty_tiers**](LoyaltiesApi.md#create_in_bulk_loyalty_tiers) | **POST** /v1/loyalties/{campaignId}/tiers | Create loyalty tiers +[**create_loyalty_program**](LoyaltiesApi.md#create_loyalty_program) | **POST** /v1/loyalties | Create Loyalty Campaign +[**create_points_expiration_export**](LoyaltiesApi.md#create_points_expiration_export) | **POST** /v1/loyalties/{campaignId}/points-expiration/export | Create Points Expiration Export +[**create_reward_assignment1**](LoyaltiesApi.md#create_reward_assignment1) | **POST** /v1/loyalties/{campaignId}/rewards | Create Reward Assignment +[**delete_earning_rule**](LoyaltiesApi.md#delete_earning_rule) | **DELETE** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Delete Earning Rule +[**delete_loyalty_program**](LoyaltiesApi.md#delete_loyalty_program) | **DELETE** /v1/loyalties/{campaignId} | Delete Loyalty Campaign +[**delete_reward_assignment1**](LoyaltiesApi.md#delete_reward_assignment1) | **DELETE** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Delete Reward Assignment +[**disable_earning_rule**](LoyaltiesApi.md#disable_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable | Disable Earning Rule +[**enable_earning_rule**](LoyaltiesApi.md#enable_earning_rule) | **POST** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable | Enable Earning Rule +[**export_loyalty_card_transactions**](LoyaltiesApi.md#export_loyalty_card_transactions) | **POST** /v1/loyalties/members/{memberId}/transactions/export | Export Loyalty Card Transactions +[**export_loyalty_card_transactions1**](LoyaltiesApi.md#export_loyalty_card_transactions1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transactions/export | Export Loyalty Card Transactions +[**get_earning_rule**](LoyaltiesApi.md#get_earning_rule) | **GET** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Get Earning Rule +[**get_loyalty_program**](LoyaltiesApi.md#get_loyalty_program) | **GET** /v1/loyalties/{campaignId} | Get Loyalty Campaign +[**get_loyalty_tier**](LoyaltiesApi.md#get_loyalty_tier) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} | Get Loyalty Tier +[**get_member**](LoyaltiesApi.md#get_member) | **GET** /v1/loyalties/members/{memberId} | Get Member +[**get_member1**](LoyaltiesApi.md#get_member1) | **GET** /v1/loyalties/{campaignId}/members/{memberId} | Get Member +[**get_reward_assignment1**](LoyaltiesApi.md#get_reward_assignment1) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} | Get Reward Assignment +[**get_reward_assignment2**](LoyaltiesApi.md#get_reward_assignment2) | **GET** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Get Reward Assignment +[**get_reward_details**](LoyaltiesApi.md#get_reward_details) | **GET** /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward | Get Reward Details +[**list_earning_rules**](LoyaltiesApi.md#list_earning_rules) | **GET** /v1/loyalties/{campaignId}/earning-rules | List Earning Rules +[**list_loyalty_card_transactions**](LoyaltiesApi.md#list_loyalty_card_transactions) | **GET** /v1/loyalties/members/{memberId}/transactions | List Loyalty Card Transactions +[**list_loyalty_card_transactions1**](LoyaltiesApi.md#list_loyalty_card_transactions1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/transactions | List Loyalty Card Transactions +[**list_loyalty_programs**](LoyaltiesApi.md#list_loyalty_programs) | **GET** /v1/loyalties | List Loyalty Campaigns +[**list_loyalty_tier_earning_rules**](LoyaltiesApi.md#list_loyalty_tier_earning_rules) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules | List Loyalty Tier Earning Rules +[**list_loyalty_tier_rewards**](LoyaltiesApi.md#list_loyalty_tier_rewards) | **GET** /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards | List Loyalty Tier Rewards +[**list_loyalty_tiers**](LoyaltiesApi.md#list_loyalty_tiers) | **GET** /v1/loyalties/{campaignId}/tiers | List Loyalty Tiers +[**list_member_activity**](LoyaltiesApi.md#list_member_activity) | **GET** /v1/loyalties/members/{memberId}/activity | List Member Activity +[**list_member_activity1**](LoyaltiesApi.md#list_member_activity1) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/activity | List Member Activity +[**list_member_loyalty_tier**](LoyaltiesApi.md#list_member_loyalty_tier) | **GET** /v1/loyalties/members/{memberId}/tiers | List Member's Loyalty Tiers +[**list_member_rewards**](LoyaltiesApi.md#list_member_rewards) | **GET** /v1/loyalties/members/{memberId}/rewards | List Member Rewards +[**list_members**](LoyaltiesApi.md#list_members) | **GET** /v1/loyalties/{campaignId}/members | List Members +[**list_points_expiration**](LoyaltiesApi.md#list_points_expiration) | **GET** /v1/loyalties/{campaignId}/members/{memberId}/points-expiration | Get Points Expiration +[**list_reward_assignments1**](LoyaltiesApi.md#list_reward_assignments1) | **GET** /v1/loyalties/{campaignId}/reward-assignments | List Reward Assignments +[**list_reward_assignments2**](LoyaltiesApi.md#list_reward_assignments2) | **GET** /v1/loyalties/{campaignId}/rewards | List Reward Assignments +[**redeem_reward**](LoyaltiesApi.md#redeem_reward) | **POST** /v1/loyalties/members/{memberId}/redemption | Redeem Reward +[**redeem_reward1**](LoyaltiesApi.md#redeem_reward1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/redemption | Redeem Reward +[**transfer_points**](LoyaltiesApi.md#transfer_points) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/transfers | Transfer Loyalty Points +[**update_earning_rule**](LoyaltiesApi.md#update_earning_rule) | **PUT** /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} | Update Earning Rule +[**update_loyalty_card_balance**](LoyaltiesApi.md#update_loyalty_card_balance) | **POST** /v1/loyalties/members/{memberId}/balance | Add or Remove Loyalty Card Balance +[**update_loyalty_card_balance1**](LoyaltiesApi.md#update_loyalty_card_balance1) | **POST** /v1/loyalties/{campaignId}/members/{memberId}/balance | Add or Remove Loyalty Card Balance +[**update_loyalty_program**](LoyaltiesApi.md#update_loyalty_program) | **PUT** /v1/loyalties/{campaignId} | Update Loyalty Campaign +[**update_reward_assignment1**](LoyaltiesApi.md#update_reward_assignment1) | **PUT** /v1/loyalties/{campaignId}/rewards/{assignmentId} | Update Reward Assignment + + +# **add_member** +> LoyaltiesMembersCreateResponseBody add_member(campaign_id, loyalties_members_create_request_body=loyalties_members_create_request_body) + +Add Member + +This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_create_request_body import LoyaltiesMembersCreateRequestBody +from voucherify.models.loyalties_members_create_response_body import LoyaltiesMembersCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID of the loyalty program. + loyalties_members_create_request_body = {"customer":"source_customer_1","metadata":{"year":2022},"channel":"postman","voucher":"KpzbHUY5"} # LoyaltiesMembersCreateRequestBody | Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. (optional) + + try: + # Add Member + api_response = api_instance.add_member(campaign_id, loyalties_members_create_request_body=loyalties_members_create_request_body) + print("The response of LoyaltiesApi->add_member:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->add_member: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID of the loyalty program. | + **loyalties_members_create_request_body** | [**LoyaltiesMembersCreateRequestBody**](LoyaltiesMembersCreateRequestBody.md)| Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. | [optional] + +### Return type + +[**LoyaltiesMembersCreateResponseBody**](LoyaltiesMembersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the voucher object that was published to the customer provided in the request payload. | - | + +[[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) + +# **create_earning_rule** +> List[LoyaltiesEarningRulesCreateResponseBody] create_earning_rule(campaign_id, loyalties_earning_rules_create_request_body_item=loyalties_earning_rules_create_request_body_item) + +Create Earning Rule + +Create earning rules for a loyalty campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_earning_rules_create_request_body_item import LoyaltiesEarningRulesCreateRequestBodyItem +from voucherify.models.loyalties_earning_rules_create_response_body import LoyaltiesEarningRulesCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + loyalties_earning_rules_create_request_body_item = [{"event":"order.paid","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"FIXED","points":"5"},"source":{"banner":"Order paid 5 points."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - fixed amount of points"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_AMOUNT","order":{"amount":{"every":1,"points":1}}},"source":{"banner":"Order paid - 1 point for 1 dollar spent excluding discounts."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_TOTAL_AMOUNT","order":{"total_amount":{"every":1,"points":1}}},"source":{"banner":"Order paid - 1 point for 1 dollar spent including discounts."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order total amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_METADATA","order":{"metadata":{"every":2,"points":1,"property":"number_of_store_visits"}}},"source":{"banner":"Order paid - 2 points for each store visit."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to numerical order metadata property "}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_ITEMS_AMOUNT","order_items":{"amount":{"every":2,"points":1,"object":"product","id":"prod_0bae32322150fd0546"}}},"source":{"banner":"Order paid - 2 points for 1 dollar spent on items excluding discounts."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order items amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_ITEMS_SUBTOTAL_AMOUNT","order_items":{"subtotal_amount":{"every":2,"points":1,"object":"products_collection","id":"pc_75U0dHlr7u75BJodrW1AE3t6"}}},"source":{"banner":"Order paid - 2 points for every dollar spent on the product collection."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid- points proportional to order items subtotal amount"}},{"event":"order.paid","validation_rule_id":null,"loyalty":{"type":"PROPORTIONAL","calculation_type":"ORDER_ITEMS_QUANTITY","order_items":{"quantity":{"every":1,"points":1,"object":"sku","id":"sku_0b7d7dfb090be5c619"}}},"source":{"banner":"Order paid - 1 point for every brand phone in your cart."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - points proportional to quantity of items in a cart of a product varient."}},{"event":"order.paid","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":1,"property":"customer_life_time_value"}}},"source":{"banner":"Order paid 1 point for 1 month of being a customer with us."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - points proportional to customer metadata property"}},{"event":"customer.segment.entered","segment":{"id":"seg_OlE7DmfzMI5pHyD5VAv512r1"},"validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":1,"property":"customer_life_time_value"}}},"source":{"banner":"Customer entered birthday segment - 1 point for each month of being a customer with us."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Entered segment - points proportional to customer metadata property"}},{"event":"customer.segment.entered","segment":{"id":"seg_OlE7DmfzMI5pHyD5VAv512r1"},"validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"FIXED","points":"5"},"source":{"banner":"Customer entered birthday segment - 5 points"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Entered segment - fixed points"}},{"event":"page_view","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"points":3,"type":"FIXED"},"custom_event":{"schema_id":"ms_gn4Qe4xsFPf7orCArCiNVY13"},"source":{"banner":"See page - 3 points"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - fixed points for viewing a page"}},{"event":"page_view","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOM_EVENT_METADATA","custom_event":{"metadata":{"every":1,"points":2,"property":"volume_number"}}},"custom_event":{"schema_id":"ms_gn4Qe4xsFPf7orCArCiNVY13"},"source":{"banner":"See page X - get 2 points multiplied by the page number"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - proportional points for viewing a page based on custom event metadata"}},{"event":"page_view","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":2,"property":"customer_life_time_value"}}},"custom_event":{"schema_id":"ms_gn4Qe4xsFPf7orCArCiNVY13"},"source":{"banner":"Get 2 points for every month you're a customer for viewing a page"},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - proportional points for viewing a page based on customer metadata"}},{"event":"customer.loyalty.tier.prolonged","validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"PROPORTIONAL","calculation_type":"CUSTOMER_METADATA","customer":{"metadata":{"every":1,"points":2,"property":"customer_life_time_value"}}},"loyalty_tier":{"id":"ltr_pudTGWasuIqxdiDM0go31OV1"},"source":{"banner":"Get 2 points for every month you're a customer when your loyalty tier is prolonged."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Custom Event - proportional points for extending a loyalty tier based on customer metadata."}}] # List[LoyaltiesEarningRulesCreateRequestBodyItem] | Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object (optional) + + try: + # Create Earning Rule + api_response = api_instance.create_earning_rule(campaign_id, loyalties_earning_rules_create_request_body_item=loyalties_earning_rules_create_request_body_item) + print("The response of LoyaltiesApi->create_earning_rule:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->create_earning_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **loyalties_earning_rules_create_request_body_item** | [**List[LoyaltiesEarningRulesCreateRequestBodyItem]**](LoyaltiesEarningRulesCreateRequestBodyItem.md)| Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object | [optional] + +### Return type + +[**List[LoyaltiesEarningRulesCreateResponseBody]**](LoyaltiesEarningRulesCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an array of earning rule objects. | - | + +[[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) + +# **create_in_bulk_loyalty_tiers** +> List[LoyaltyTier] create_in_bulk_loyalty_tiers(campaign_id, loyalties_tiers_create_in_bulk_request_body_item=loyalties_tiers_create_in_bulk_request_body_item) + +Create loyalty tiers + +Creates loyalty tiers for desired campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_tiers_create_in_bulk_request_body_item import LoyaltiesTiersCreateInBulkRequestBodyItem +from voucherify.models.loyalty_tier import LoyaltyTier +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique loyalty campaign ID or name. + loyalties_tiers_create_in_bulk_request_body_item = [voucherify.LoyaltiesTiersCreateInBulkRequestBodyItem()] # List[LoyaltiesTiersCreateInBulkRequestBodyItem] | Provide tier definitions you want to add to existing loyalty campaign. (optional) + + try: + # Create loyalty tiers + api_response = api_instance.create_in_bulk_loyalty_tiers(campaign_id, loyalties_tiers_create_in_bulk_request_body_item=loyalties_tiers_create_in_bulk_request_body_item) + print("The response of LoyaltiesApi->create_in_bulk_loyalty_tiers:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->create_in_bulk_loyalty_tiers: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique loyalty campaign ID or name. | + **loyalties_tiers_create_in_bulk_request_body_item** | [**List[LoyaltiesTiersCreateInBulkRequestBodyItem]**](LoyaltiesTiersCreateInBulkRequestBodyItem.md)| Provide tier definitions you want to add to existing loyalty campaign. | [optional] + +### Return type + +[**List[LoyaltyTier]**](LoyaltyTier.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns created loyalty tiers. | - | + +[[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) + +# **create_loyalty_program** +> LoyaltiesCreateCampaignResponseBody create_loyalty_program(loyalties_create_campaign_request_body=loyalties_create_campaign_request_body) + +Create Loyalty Campaign + +Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. ๐Ÿ“˜ Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. ๐Ÿšง Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_create_campaign_request_body import LoyaltiesCreateCampaignRequestBody +from voucherify.models.loyalties_create_campaign_response_body import LoyaltiesCreateCampaignResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + loyalties_create_campaign_request_body = {"name":"Loyalty Program 4","description":"This is a campaign description.","auto_join":true,"join_once":true,"use_voucher_metadata_schema":true,"start_date":"2016-10-26T00:00:00Z","expiration_date":"2024-10-26T00:00:00Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"activity_duration_after_publishing":"P24D","category_id":"cat_0b6152ce12414820dc","vouchers_count":2,"voucher":{"type":"LOYALTY_CARD","loyalty_card":{"points":0,"expiration_rules":{"period_type":"MONTH","period_value":3,"rounding_type":"END_OF_QUARTER"}},"redemption":{"quantity":2},"code_config":{"pattern":"L-CARD-#######"}},"metadata":{"test":true},"type":"STATIC","loyalty_tiers_expiration":{"qualification_type":"BALANCE","start_date":{"type":"IMMEDIATE"},"expiration_date":{"type":"CUSTOM","extend":"P3M","rounding":{"type":"MONTH","strategy":"END"}}}} # LoyaltiesCreateCampaignRequestBody | Specify the loyalty campaign details. (optional) + + try: + # Create Loyalty Campaign + api_response = api_instance.create_loyalty_program(loyalties_create_campaign_request_body=loyalties_create_campaign_request_body) + print("The response of LoyaltiesApi->create_loyalty_program:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->create_loyalty_program: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **loyalties_create_campaign_request_body** | [**LoyaltiesCreateCampaignRequestBody**](LoyaltiesCreateCampaignRequestBody.md)| Specify the loyalty campaign details. | [optional] + +### Return type + +[**LoyaltiesCreateCampaignResponseBody**](LoyaltiesCreateCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a campaign object with its settings but without the loyalty card codes. | - | + +[[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) + +# **create_points_expiration_export** +> LoyaltiesPointsExpirationExportCreateResponseBody create_points_expiration_export(campaign_id, loyalties_points_expiration_export_create_request_body=loyalties_points_expiration_export_create_request_body) + +Create Points Expiration Export + +Schedule the generation of a points expiration CSV file for a particular campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_points_expiration_export_create_request_body import LoyaltiesPointsExpirationExportCreateRequestBody +from voucherify.models.loyalties_points_expiration_export_create_response_body import LoyaltiesPointsExpirationExportCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID or name. + loyalties_points_expiration_export_create_request_body = {"parameters":{"fields":["id","campaign_id","voucher_id","status","expires_at","points"],"order":"-expires_at","filters":{"junction":"and","voucher_id":{"conditions":{"$in":["v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF","v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655"]}}}}} # LoyaltiesPointsExpirationExportCreateRequestBody | Specify the data filters, types of data to return and order in which the results should be returned. (optional) + + try: + # Create Points Expiration Export + api_response = api_instance.create_points_expiration_export(campaign_id, loyalties_points_expiration_export_create_request_body=loyalties_points_expiration_export_create_request_body) + print("The response of LoyaltiesApi->create_points_expiration_export:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->create_points_expiration_export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID or name. | + **loyalties_points_expiration_export_create_request_body** | [**LoyaltiesPointsExpirationExportCreateRequestBody**](LoyaltiesPointsExpirationExportCreateRequestBody.md)| Specify the data filters, types of data to return and order in which the results should be returned. | [optional] + +### Return type + +[**LoyaltiesPointsExpirationExportCreateResponseBody**](LoyaltiesPointsExpirationExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an object with the export ID of the scheduled generation of CSV file with exported points expirations. You can use either the <!-- [Get Export](OpenAPI.json/paths/~1exports~1{exportId}/get) -->[Get Export](ref:get-export) endpoint to view the status and obtain the URL of the CSV file or <!-- [Download Export](OpenAPI.json/paths/~1exports~1{export_Id}/get) -->[Download Export](ref:download-export) endpoint to download the CSV file. | - | + +[[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) + +# **create_reward_assignment1** +> LoyaltiesRewardsCreateAssignmentResponseBody create_reward_assignment1(campaign_id, loyalties_rewards_create_assignment_item_request_body=loyalties_rewards_create_assignment_item_request_body) + +Create Reward Assignment + +Add rewards to a loyalty campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_rewards_create_assignment_item_request_body import LoyaltiesRewardsCreateAssignmentItemRequestBody +from voucherify.models.loyalties_rewards_create_assignment_response_body import LoyaltiesRewardsCreateAssignmentResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + loyalties_rewards_create_assignment_item_request_body = [{"reward":"rew_wg2pvCr5LDhCq4uVQZ9LhuZm","parameters":{"loyalty":{"points":2}}},{"reward":"rew_z35ffKoH0tCcck8EL56p6SIs","parameters":{"loyalty":{"points":2}}}] # List[LoyaltiesRewardsCreateAssignmentItemRequestBody] | Define the cost of the rewards in loyalty points. (optional) + + try: + # Create Reward Assignment + api_response = api_instance.create_reward_assignment1(campaign_id, loyalties_rewards_create_assignment_item_request_body=loyalties_rewards_create_assignment_item_request_body) + print("The response of LoyaltiesApi->create_reward_assignment1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->create_reward_assignment1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **loyalties_rewards_create_assignment_item_request_body** | [**List[LoyaltiesRewardsCreateAssignmentItemRequestBody]**](LoyaltiesRewardsCreateAssignmentItemRequestBody.md)| Define the cost of the rewards in loyalty points. | [optional] + +### Return type + +[**LoyaltiesRewardsCreateAssignmentResponseBody**](LoyaltiesRewardsCreateAssignmentResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of reward assignment objects. | - | + +[[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) + +# **delete_earning_rule** +> delete_earning_rule(campaign_id, earning_rule_id) + +Delete Earning Rule + +This method deletes an earning rule for a specific loyalty campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + earning_rule_id = 'earning_rule_id_example' # str | A unique earning rule ID. + + try: + # Delete Earning Rule + api_instance.delete_earning_rule(campaign_id, earning_rule_id) + except Exception as e: + print("Exception when calling LoyaltiesApi->delete_earning_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **earning_rule_id** | **str**| A unique earning rule ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **delete_loyalty_program** +> LoyaltiesDeleteResponseBody delete_loyalty_program(campaign_id, force=force) + +Delete Loyalty Campaign + +Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_delete_response_body import LoyaltiesDeleteResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + force = True # bool | If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. (optional) + + try: + # Delete Loyalty Campaign + api_response = api_instance.delete_loyalty_program(campaign_id, force=force) + print("The response of LoyaltiesApi->delete_loyalty_program:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->delete_loyalty_program: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **force** | **bool**| If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. | [optional] + +### Return type + +[**LoyaltiesDeleteResponseBody**](LoyaltiesDeleteResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the loyalty campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **delete_reward_assignment1** +> delete_reward_assignment1(campaign_id, assignment_id) + +Delete Reward Assignment + +This method deletes a reward assignment for a particular loyalty campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. + + try: + # Delete Reward Assignment + api_instance.delete_reward_assignment1(campaign_id, assignment_id) + except Exception as e: + print("Exception when calling LoyaltiesApi->delete_reward_assignment1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **assignment_id** | **str**| A unique reward assignment ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **disable_earning_rule** +> LoyaltiesEarningRulesDisableResponseBody disable_earning_rule(campaign_id, earning_rule_id) + +Disable Earning Rule + +Disable an earning rule. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_earning_rules_disable_response_body import LoyaltiesEarningRulesDisableResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID or name. + earning_rule_id = 'earning_rule_id_example' # str | Unique earning rule ID. + + try: + # Disable Earning Rule + api_response = api_instance.disable_earning_rule(campaign_id, earning_rule_id) + print("The response of LoyaltiesApi->disable_earning_rule:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->disable_earning_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID or name. | + **earning_rule_id** | **str**| Unique earning rule ID. | + +### Return type + +[**LoyaltiesEarningRulesDisableResponseBody**](LoyaltiesEarningRulesDisableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an earning rule object with the `active` parameter set to `false`. | - | + +[[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) + +# **enable_earning_rule** +> LoyaltiesEarningRulesEnableResponseBody enable_earning_rule(campaign_id, earning_rule_id) + +Enable Earning Rule + +Enable an earning rule. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_earning_rules_enable_response_body import LoyaltiesEarningRulesEnableResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID or name. + earning_rule_id = 'earning_rule_id_example' # str | Unique earning rule ID. + + try: + # Enable Earning Rule + api_response = api_instance.enable_earning_rule(campaign_id, earning_rule_id) + print("The response of LoyaltiesApi->enable_earning_rule:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->enable_earning_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID or name. | + **earning_rule_id** | **str**| Unique earning rule ID. | + +### Return type + +[**LoyaltiesEarningRulesEnableResponseBody**](LoyaltiesEarningRulesEnableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an earning rule object with the `active` parameter set to `true`. | - | + +[[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_transactions** +> LoyaltiesMembersTransactionsExportCreateResponseBody export_loyalty_card_transactions(member_id, loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body) + +Export Loyalty Card Transactions + +Export transactions that are associated with point movements on a loyalty card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_transactions_export_create_request_body import LoyaltiesMembersTransactionsExportCreateRequestBody +from voucherify.models.loyalties_members_transactions_export_create_response_body import LoyaltiesMembersTransactionsExportCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | A unique code identifying the loyalty card that you are looking to export transaction data for. + loyalties_members_transactions_export_create_request_body = {"parameters":{"order":"-created_at","fields":["id","type","source_id","reason","balance","amount","created_at","voucher_id","campaign_id","details","related_transaction_id"]}} # LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. (optional) + + try: + # Export Loyalty Card Transactions + api_response = api_instance.export_loyalty_card_transactions(member_id, loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body) + print("The response of LoyaltiesApi->export_loyalty_card_transactions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->export_loyalty_card_transactions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| A unique code identifying the loyalty card that you are looking to export transaction data for. | + **loyalties_members_transactions_export_create_request_body** | [**LoyaltiesMembersTransactionsExportCreateRequestBody**](LoyaltiesMembersTransactionsExportCreateRequestBody.md)| Specify the parameters and filters for the transaction export. | [optional] + +### Return type + +[**LoyaltiesMembersTransactionsExportCreateResponseBody**](LoyaltiesMembersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an export object. | - | + +[[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_transactions1** +> LoyaltiesMembersTransactionsExportCreateResponseBody export_loyalty_card_transactions1(campaign_id, member_id, loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body) + +Export Loyalty Card Transactions + +Export transactions that are associated with point movements on a loyalty card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_transactions_export_create_request_body import LoyaltiesMembersTransactionsExportCreateRequestBody +from voucherify.models.loyalties_members_transactions_export_create_response_body import LoyaltiesMembersTransactionsExportCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. + member_id = 'member_id_example' # str | A unique code identifying the loyalty card that you are looking to export transaction data for. + loyalties_members_transactions_export_create_request_body = {"parameters":{"order":"-created_at","fields":["id","type","source_id","reason","balance","amount","created_at","voucher_id","campaign_id","details","related_transaction_id"]}} # LoyaltiesMembersTransactionsExportCreateRequestBody | Specify the parameters and filters for the transaction export. (optional) + + try: + # Export Loyalty Card Transactions + api_response = api_instance.export_loyalty_card_transactions1(campaign_id, member_id, loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body) + print("The response of LoyaltiesApi->export_loyalty_card_transactions1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->export_loyalty_card_transactions1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. | + **member_id** | **str**| A unique code identifying the loyalty card that you are looking to export transaction data for. | + **loyalties_members_transactions_export_create_request_body** | [**LoyaltiesMembersTransactionsExportCreateRequestBody**](LoyaltiesMembersTransactionsExportCreateRequestBody.md)| Specify the parameters and filters for the transaction export. | [optional] + +### Return type + +[**LoyaltiesMembersTransactionsExportCreateResponseBody**](LoyaltiesMembersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an export object. | - | + +[[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) + +# **get_earning_rule** +> LoyaltiesEarningRulesGetResponseBody get_earning_rule(campaign_id, earning_rule_id) + +Get Earning Rule + +Retrieves an earning rule assigned to a campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_earning_rules_get_response_body import LoyaltiesEarningRulesGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + earning_rule_id = 'earning_rule_id_example' # str | A unique earning rule ID. + + try: + # Get Earning Rule + api_response = api_instance.get_earning_rule(campaign_id, earning_rule_id) + print("The response of LoyaltiesApi->get_earning_rule:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_earning_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **earning_rule_id** | **str**| A unique earning rule ID. | + +### Return type + +[**LoyaltiesEarningRulesGetResponseBody**](LoyaltiesEarningRulesGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an earning rule object with the earning rule details. | - | + +[[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) + +# **get_loyalty_program** +> LoyaltiesGetCampaignResponseBody get_loyalty_program(campaign_id) + +Get Loyalty Campaign + +Retrieve a specific loyalty campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_get_campaign_response_body import LoyaltiesGetCampaignResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + + try: + # Get Loyalty Campaign + api_response = api_instance.get_loyalty_program(campaign_id) + print("The response of LoyaltiesApi->get_loyalty_program:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_loyalty_program: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + +### Return type + +[**LoyaltiesGetCampaignResponseBody**](LoyaltiesGetCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a loyalty campaign object for a given loyalty campaign ID. | - | + +[[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) + +# **get_loyalty_tier** +> LoyaltiesTiersGetResponseBody get_loyalty_tier(campaign_id, loyalty_tier_id) + +Get Loyalty Tier + +Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_tiers_get_response_body import LoyaltiesTiersGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique loyalty campaign ID or name. + loyalty_tier_id = 'loyalty_tier_id_example' # str | Unique loyalty tier ID. + + try: + # Get Loyalty Tier + api_response = api_instance.get_loyalty_tier(campaign_id, loyalty_tier_id) + print("The response of LoyaltiesApi->get_loyalty_tier:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_loyalty_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique loyalty campaign ID or name. | + **loyalty_tier_id** | **str**| Unique loyalty tier ID. | + +### Return type + +[**LoyaltiesTiersGetResponseBody**](LoyaltiesTiersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a loyalty tier object. | - | + +[[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) + +# **get_member** +> LoyaltiesMembersGetResponseBody get_member(member_id) + +Get Member + +Retrieve loyalty card with the given member ID (i.e. voucher code). ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_get_response_body import LoyaltiesMembersGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | Unique loyalty card code assigned to a particular customer. + + try: + # Get Member + api_response = api_instance.get_member(member_id) + print("The response of LoyaltiesApi->get_member:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_member: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| Unique loyalty card code assigned to a particular customer. | + +### Return type + +[**LoyaltiesMembersGetResponseBody**](LoyaltiesMembersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns loyalty card details. | - | + +[[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) + +# **get_member1** +> LoyaltiesMembersGetResponseBody get_member1(campaign_id, member_id) + +Get Member + +Retrieves the loyalty card with the given member ID (i.e. voucher code). + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_get_response_body import LoyaltiesMembersGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID. + member_id = 'member_id_example' # str | Unique code that identifies the loyalty card. + + try: + # Get Member + api_response = api_instance.get_member1(campaign_id, member_id) + print("The response of LoyaltiesApi->get_member1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_member1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID. | + **member_id** | **str**| Unique code that identifies the loyalty card. | + +### Return type + +[**LoyaltiesMembersGetResponseBody**](LoyaltiesMembersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns loyalty card details. | - | + +[[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) + +# **get_reward_assignment1** +> LoyaltiesRewardAssignmentsGetResponseBody get_reward_assignment1(campaign_id, assignment_id) + +Get Reward Assignment + +Retrieve specific reward assignment. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_reward_assignments_get_response_body import LoyaltiesRewardAssignmentsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + assignment_id = 'assignment_id_example' # str | Unique reward assignment ID. + + try: + # Get Reward Assignment + api_response = api_instance.get_reward_assignment1(campaign_id, assignment_id) + print("The response of LoyaltiesApi->get_reward_assignment1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_reward_assignment1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **assignment_id** | **str**| Unique reward assignment ID. | + +### Return type + +[**LoyaltiesRewardAssignmentsGetResponseBody**](LoyaltiesRewardAssignmentsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns specific reward assignment. | - | + +[[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) + +# **get_reward_assignment2** +> LoyaltiesRewardsGetResponseBody get_reward_assignment2(campaign_id, assignment_id) + +Get Reward Assignment + +Retrieve specific reward assignment. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_rewards_get_response_body import LoyaltiesRewardsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. + + try: + # Get Reward Assignment + api_response = api_instance.get_reward_assignment2(campaign_id, assignment_id) + print("The response of LoyaltiesApi->get_reward_assignment2:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_reward_assignment2: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **assignment_id** | **str**| A unique reward assignment ID. | + +### Return type + +[**LoyaltiesRewardsGetResponseBody**](LoyaltiesRewardsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns specific reward assignment. | - | + +[[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) + +# **get_reward_details** +> LoyaltiesRewardAssignmentsRewardGetResponseBody get_reward_details(campaign_id, assignment_id) + +Get Reward Details + +Get reward details in the context of a loyalty campaign and reward assignment ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_reward_assignments_reward_get_response_body import LoyaltiesRewardAssignmentsRewardGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + assignment_id = 'assignment_id_example' # str | Unique reward assignment ID. + + try: + # Get Reward Details + api_response = api_instance.get_reward_details(campaign_id, assignment_id) + print("The response of LoyaltiesApi->get_reward_details:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->get_reward_details: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **assignment_id** | **str**| Unique reward assignment ID. | + +### Return type + +[**LoyaltiesRewardAssignmentsRewardGetResponseBody**](LoyaltiesRewardAssignmentsRewardGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns reward details in the context of a loyalty *campaign* and reward assignment ID. | - | + +[[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) + +# **list_earning_rules** +> LoyaltiesEarningRulesListResponseBody list_earning_rules(campaign_id, limit=limit, page=page, order=order) + +List Earning Rules + +Returns a list of all earning rules within a given campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_earning_rules_list_response_body import LoyaltiesEarningRulesListResponseBody +from voucherify.models.parameter_order_list_earning_rules import ParameterOrderListEarningRules +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListEarningRules() # ParameterOrderListEarningRules | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Earning Rules + api_response = api_instance.list_earning_rules(campaign_id, limit=limit, page=page, order=order) + print("The response of LoyaltiesApi->list_earning_rules:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_earning_rules: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListEarningRules**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**LoyaltiesEarningRulesListResponseBody**](LoyaltiesEarningRulesListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of earning rules. | - | + +[[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) + +# **list_loyalty_card_transactions** +> LoyaltiesMembersTransactionsListResponseBody list_loyalty_card_transactions(member_id, limit=limit, order=order, starting_after_id=starting_after_id) + +List Loyalty Card Transactions + +Retrieve transaction data related to point movements for a specific loyalty card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_transactions_list_response_body import LoyaltiesMembersTransactionsListResponseBody +from voucherify.models.parameter_order_list_transactions import ParameterOrderListTransactions +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderListTransactions() # ParameterOrderListTransactions | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after_id = 'starting_after_id_example' # str | A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. (optional) + + try: + # List Loyalty Card Transactions + api_response = api_instance.list_loyalty_card_transactions(member_id, limit=limit, order=order, starting_after_id=starting_after_id) + print("The response of LoyaltiesApi->list_loyalty_card_transactions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_loyalty_card_transactions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderListTransactions**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after_id** | **str**| A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. | [optional] + +### Return type + +[**LoyaltiesMembersTransactionsListResponseBody**](LoyaltiesMembersTransactionsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of loyalty card transaction objects. | - | + +[[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) + +# **list_loyalty_card_transactions1** +> LoyaltiesMembersTransactionsListResponseBody list_loyalty_card_transactions1(campaign_id, member_id, limit=limit, order=order, starting_after_id=starting_after_id) + +List Loyalty Card Transactions + +Retrieve transaction data related to point movements for a specific loyalty card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_transactions_list_response_body import LoyaltiesMembersTransactionsListResponseBody +from voucherify.models.parameter_order_list_transactions import ParameterOrderListTransactions +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. + member_id = 'member_id_example' # str | A unique code identifying the loyalty card that you are looking to retrieve transaction data for. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderListTransactions() # ParameterOrderListTransactions | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after_id = 'starting_after_id_example' # str | A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. (optional) + + try: + # List Loyalty Card Transactions + api_response = api_instance.list_loyalty_card_transactions1(campaign_id, member_id, limit=limit, order=order, starting_after_id=starting_after_id) + print("The response of LoyaltiesApi->list_loyalty_card_transactions1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_loyalty_card_transactions1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. | + **member_id** | **str**| A unique code identifying the loyalty card that you are looking to retrieve transaction data for. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderListTransactions**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after_id** | **str**| A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. | [optional] + +### Return type + +[**LoyaltiesMembersTransactionsListResponseBody**](LoyaltiesMembersTransactionsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of loyalty card transaction objects. | - | + +[[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) + +# **list_loyalty_programs** +> LoyaltiesListCampaignsResponseBody list_loyalty_programs(limit=limit, page=page, order=order) + +List Loyalty Campaigns + +Returns a list of your loyalty campaigns. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_list_campaigns_response_body import LoyaltiesListCampaignsResponseBody +from voucherify.models.parameter_order_list_campaigns import ParameterOrderListCampaigns +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListCampaigns() # ParameterOrderListCampaigns | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Loyalty Campaigns + api_response = api_instance.list_loyalty_programs(limit=limit, page=page, order=order) + print("The response of LoyaltiesApi->list_loyalty_programs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_loyalty_programs: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListCampaigns**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**LoyaltiesListCampaignsResponseBody**](LoyaltiesListCampaignsResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with loyalty program objects. The loyalty campaigns are returned sorted by creation date, with the most recent campaigns appearing first. | - | + +[[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) + +# **list_loyalty_tier_earning_rules** +> LoyaltiesTiersEarningRulesListResponseBody list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, limit=limit, page=page) + +List Loyalty Tier Earning Rules + +Retrieve available earning rules for a given tier and the calculation method for earning points. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_tiers_earning_rules_list_response_body import LoyaltiesTiersEarningRulesListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID or name. + loyalty_tier_id = 'loyalty_tier_id_example' # str | Unique loyalty tier ID. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + + try: + # List Loyalty Tier Earning Rules + api_response = api_instance.list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, limit=limit, page=page) + print("The response of LoyaltiesApi->list_loyalty_tier_earning_rules:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_loyalty_tier_earning_rules: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID or name. | + **loyalty_tier_id** | **str**| Unique loyalty tier ID. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + +### Return type + +[**LoyaltiesTiersEarningRulesListResponseBody**](LoyaltiesTiersEarningRulesListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of earning rules for a given tier. The object for each earning rule also contains information about how the points are calculated; this includes mapping. If a specific multiplier was used to calculate points for a given tier, then the `loyalty.points` parameter will account for this calculation. | - | + +[[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) + +# **list_loyalty_tier_rewards** +> LoyaltiesTiersRewardsListResponseBody list_loyalty_tier_rewards(campaign_id, loyalty_tier_id) + +List Loyalty Tier Rewards + +Get available rewards for a given tier. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_tiers_rewards_list_response_body import LoyaltiesTiersRewardsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID or name. + loyalty_tier_id = 'loyalty_tier_id_example' # str | Unique loyalty tier ID. + + try: + # List Loyalty Tier Rewards + api_response = api_instance.list_loyalty_tier_rewards(campaign_id, loyalty_tier_id) + print("The response of LoyaltiesApi->list_loyalty_tier_rewards:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_loyalty_tier_rewards: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID or name. | + **loyalty_tier_id** | **str**| Unique loyalty tier ID. | + +### Return type + +[**LoyaltiesTiersRewardsListResponseBody**](LoyaltiesTiersRewardsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of loyalty tier reward objects. | - | + +[[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) + +# **list_loyalty_tiers** +> LoyaltiesTiersListResponseBody list_loyalty_tiers(campaign_id, limit=limit, order=order) + +List Loyalty Tiers + +Retrieve a list of loyalty tiers which were added to the loyalty program. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_tiers_list_response_body import LoyaltiesTiersListResponseBody +from voucherify.models.parameter_order_list_loyalty_tiers import ParameterOrderListLoyaltyTiers +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique loyalty campaign ID or name. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderListLoyaltyTiers() # ParameterOrderListLoyaltyTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Loyalty Tiers + api_response = api_instance.list_loyalty_tiers(campaign_id, limit=limit, order=order) + print("The response of LoyaltiesApi->list_loyalty_tiers:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_loyalty_tiers: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique loyalty campaign ID or name. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderListLoyaltyTiers**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**LoyaltiesTiersListResponseBody**](LoyaltiesTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of loyalty tier objects. | - | + +[[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) + +# **list_member_activity** +> LoyaltiesMemberActivityListResponseBody list_member_activity(member_id, limit=limit, order=order, starting_after_id=starting_after_id) + +List Member Activity + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_member_activity_list_response_body import LoyaltiesMemberActivityListResponseBody +from voucherify.models.parameter_order_created_at import ParameterOrderCreatedAt +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | Unique loyalty card assigned to a particular customer. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderCreatedAt() # ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after_id = 'starting_after_id_example' # str | A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + + try: + # List Member Activity + api_response = api_instance.list_member_activity(member_id, limit=limit, order=order, starting_after_id=starting_after_id) + print("The response of LoyaltiesApi->list_member_activity:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_member_activity: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| Unique loyalty card assigned to a particular customer. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderCreatedAt**](.md)| Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after_id** | **str**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] + +### Return type + +[**LoyaltiesMemberActivityListResponseBody**](LoyaltiesMemberActivityListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of event objects related to the loyalty card. | - | + +[[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) + +# **list_member_activity1** +> LoyaltiesMemberActivityListResponseBody list_member_activity1(campaign_id, member_id, limit=limit, order=order, starting_after_id=starting_after_id) + +List Member Activity + +Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_member_activity_list_response_body import LoyaltiesMemberActivityListResponseBody +from voucherify.models.parameter_order_created_at import ParameterOrderCreatedAt +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID. + member_id = 'member_id_example' # str | A code that identifies the loyalty card. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderCreatedAt() # ParameterOrderCreatedAt | Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after_id = 'starting_after_id_example' # str | A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) + + try: + # List Member Activity + api_response = api_instance.list_member_activity1(campaign_id, member_id, limit=limit, order=order, starting_after_id=starting_after_id) + print("The response of LoyaltiesApi->list_member_activity1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_member_activity1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID. | + **member_id** | **str**| A code that identifies the loyalty card. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderCreatedAt**](.md)| Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after_id** | **str**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] + +### Return type + +[**LoyaltiesMemberActivityListResponseBody**](LoyaltiesMemberActivityListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of event objects related to the loyalty card. | - | + +[[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) + +# **list_member_loyalty_tier** +> LoyaltiesMembersTiersListResponseBody list_member_loyalty_tier(member_id) + +List Member's Loyalty Tiers + +Retrieve member tiers using the loyalty card ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_tiers_list_response_body import LoyaltiesMembersTiersListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | Unique loyalty card assigned to a particular customer. + + try: + # List Member's Loyalty Tiers + api_response = api_instance.list_member_loyalty_tier(member_id) + print("The response of LoyaltiesApi->list_member_loyalty_tier:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_member_loyalty_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| Unique loyalty card assigned to a particular customer. | + +### Return type + +[**LoyaltiesMembersTiersListResponseBody**](LoyaltiesMembersTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a data array containing the member's loyalty tiers. | - | + +[[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) + +# **list_member_rewards** +> LoyaltiesMembersRewardsListResponseBody list_member_rewards(member_id, affordable_only=affordable_only) + +List Member Rewards + +Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_rewards_list_response_body import LoyaltiesMembersRewardsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | Unique loyalty card assigned to a particular customer. + affordable_only = True # bool | Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. (optional) + + try: + # List Member Rewards + api_response = api_instance.list_member_rewards(member_id, affordable_only=affordable_only) + print("The response of LoyaltiesApi->list_member_rewards:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_member_rewards: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| Unique loyalty card assigned to a particular customer. | + **affordable_only** | **bool**| Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. | [optional] + +### Return type + +[**LoyaltiesMembersRewardsListResponseBody**](LoyaltiesMembersRewardsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of rewards for the given `member_id`. Returns a filtered list if the query parameter `affordable_only` is set to `true`. | - | + +[[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) + +# **list_members** +> LoyaltiesListMembersResponseBody list_members(campaign_id, limit=limit, page=page, customer=customer, created_at=created_at, updated_at=updated_at, order=order, code=code, ids=ids) + +List Members + +Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_list_members_response_body import LoyaltiesListMembersResponseBody +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_order_vouchers import ParameterOrderVouchers +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID of the loyalty program. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + customer = 'customer_example' # str | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + created_at = voucherify.ParameterCreatedBeforeAfter() # ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + updated_at = voucherify.ParameterUpdatedBeforeAfter() # ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + order = voucherify.ParameterOrderVouchers() # ParameterOrderVouchers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + code = 'code_example' # str | (optional) + ids = ['ids_example'] # List[str] | (optional) + + try: + # List Members + api_response = api_instance.list_members(campaign_id, limit=limit, page=page, customer=customer, created_at=created_at, updated_at=updated_at, order=order, code=code, ids=ids) + print("The response of LoyaltiesApi->list_members:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_members: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID of the loyalty program. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **customer** | **str**| A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. | [optional] + **created_at** | [**ParameterCreatedBeforeAfter**](.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] + **updated_at** | [**ParameterUpdatedBeforeAfter**](.md)| A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] + **order** | [**ParameterOrderVouchers**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **code** | **str**| | [optional] + **ids** | [**List[str]**](str.md)| | [optional] + +### Return type + +[**LoyaltiesListMembersResponseBody**](LoyaltiesListMembersResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of loyalty cards within a campaign. | - | + +[[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) + +# **list_points_expiration** +> LoyaltiesMembersPointsExpirationListResponseBody list_points_expiration(campaign_id, member_id, limit=limit, page=page) + +Get Points Expiration + +Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_points_expiration_list_response_body import LoyaltiesMembersPointsExpirationListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + member_id = 'member_id_example' # str | Loyalty card code. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + + try: + # Get Points Expiration + api_response = api_instance.list_points_expiration(campaign_id, member_id, limit=limit, page=page) + print("The response of LoyaltiesApi->list_points_expiration:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_points_expiration: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **member_id** | **str**| Loyalty card code. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + +### Return type + +[**LoyaltiesMembersPointsExpirationListResponseBody**](LoyaltiesMembersPointsExpirationListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of loyalty points expiration buckets along with an expiration date if the points are due to expire. No expiration date parameter is returned if the loyalty points bucket does not expire. | - | + +[[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) + +# **list_reward_assignments1** +> LoyaltiesRewardAssignmentsListResponseBody list_reward_assignments1(campaign_id, limit=limit, page=page, assignment_id=assignment_id) + +List Reward Assignments + +Returns reward assignments from a given loyalty campaign. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_reward_assignments_list_response_body import LoyaltiesRewardAssignmentsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. (optional) + + try: + # List Reward Assignments + api_response = api_instance.list_reward_assignments1(campaign_id, limit=limit, page=page, assignment_id=assignment_id) + print("The response of LoyaltiesApi->list_reward_assignments1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_reward_assignments1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **assignment_id** | **str**| A unique reward assignment ID. | [optional] + +### Return type + +[**LoyaltiesRewardAssignmentsListResponseBody**](LoyaltiesRewardAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with reward assignment objects. | - | + +[[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) + +# **list_reward_assignments2** +> LoyaltiesRewardsListAssignmentsResponseBody list_reward_assignments2(campaign_id, limit=limit, page=page, assignment_id=assignment_id) + +List Reward Assignments + +Returns active rewards from a given loyalty campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_rewards_list_assignments_response_body import LoyaltiesRewardsListAssignmentsResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. (optional) + + try: + # List Reward Assignments + api_response = api_instance.list_reward_assignments2(campaign_id, limit=limit, page=page, assignment_id=assignment_id) + print("The response of LoyaltiesApi->list_reward_assignments2:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->list_reward_assignments2: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **assignment_id** | **str**| A unique reward assignment ID. | [optional] + +### Return type + +[**LoyaltiesRewardsListAssignmentsResponseBody**](LoyaltiesRewardsListAssignmentsResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with reward assignment objects. | - | + +[[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) + +# **redeem_reward** +> LoyaltiesMembersRedemptionRedeemResponseBody redeem_reward(member_id, loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body) + +Redeem Reward + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_redemption_redeem_request_body import LoyaltiesMembersRedemptionRedeemRequestBody +from voucherify.models.loyalties_members_redemption_redeem_response_body import LoyaltiesMembersRedemptionRedeemResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | Unique loyalty card assigned to a particular customer. + loyalties_members_redemption_redeem_request_body = {"reward":{"id":"rew_INt3fGH3n7xIr3ZQcq4kkUZ1","points":100},"order":{"items":[{"product_id":"prod_0c5d6689b39320059b","quantity":"1"},{"product_id":"prod_0b2c36568000039138","quantity":"2"}]}} # LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + + try: + # Redeem Reward + api_response = api_instance.redeem_reward(member_id, loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body) + print("The response of LoyaltiesApi->redeem_reward:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->redeem_reward: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| Unique loyalty card assigned to a particular customer. | + **loyalties_members_redemption_redeem_request_body** | [**LoyaltiesMembersRedemptionRedeemRequestBody**](LoyaltiesMembersRedemptionRedeemRequestBody.md)| Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] + +### Return type + +[**LoyaltiesMembersRedemptionRedeemResponseBody**](LoyaltiesMembersRedemptionRedeemResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a redemption object. | - | + +[[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) + +# **redeem_reward1** +> LoyaltiesMembersRedemptionRedeemResponseBody redeem_reward1(campaign_id, member_id, loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body) + +Redeem Reward + +Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_redemption_redeem_request_body import LoyaltiesMembersRedemptionRedeemRequestBody +from voucherify.models.loyalties_members_redemption_redeem_response_body import LoyaltiesMembersRedemptionRedeemResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID. + member_id = 'member_id_example' # str | A code that identifies the loyalty card. + loyalties_members_redemption_redeem_request_body = {"reward":{"id":"rew_INt3fGH3n7xIr3ZQcq4kkUZ1","points":100},"order":{"items":[{"product_id":"prod_0c5d6689b39320059b","quantity":"1"},{"product_id":"prod_0b2c36568000039138","quantity":"2"}]}} # LoyaltiesMembersRedemptionRedeemRequestBody | Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. (optional) + + try: + # Redeem Reward + api_response = api_instance.redeem_reward1(campaign_id, member_id, loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body) + print("The response of LoyaltiesApi->redeem_reward1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->redeem_reward1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID. | + **member_id** | **str**| A code that identifies the loyalty card. | + **loyalties_members_redemption_redeem_request_body** | [**LoyaltiesMembersRedemptionRedeemRequestBody**](LoyaltiesMembersRedemptionRedeemRequestBody.md)| Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. | [optional] + +### Return type + +[**LoyaltiesMembersRedemptionRedeemResponseBody**](LoyaltiesMembersRedemptionRedeemResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a redemption object. | - | + +[[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) + +# **transfer_points** +> LoyaltiesMembersTransfersCreateResponseBody transfer_points(campaign_id, member_id, loyalties_transfer_points=loyalties_transfer_points) + +Transfer Loyalty Points + +Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_transfers_create_response_body import LoyaltiesMembersTransfersCreateResponseBody +from voucherify.models.loyalties_transfer_points import LoyaltiesTransferPoints +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). + member_id = 'member_id_example' # str | A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). + loyalties_transfer_points = [{"code":"0PmQ7JQI","points":1},{"code":"kCeufB8i","points":1}] # List[LoyaltiesTransferPoints] | Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. (optional) + + try: + # Transfer Loyalty Points + api_response = api_instance.transfer_points(campaign_id, member_id, loyalties_transfer_points=loyalties_transfer_points) + print("The response of LoyaltiesApi->transfer_points:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->transfer_points: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). | + **member_id** | **str**| A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). | + **loyalties_transfer_points** | [**List[LoyaltiesTransferPoints]**](LoyaltiesTransferPoints.md)| Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. | [optional] + +### Return type + +[**LoyaltiesMembersTransfersCreateResponseBody**](LoyaltiesMembersTransfersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a loyalty card object for the loaded loyalty card, ie. the one that that points were transferred to from the other cards(s). | - | + +[[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) + +# **update_earning_rule** +> LoyaltiesEarningRulesUpdateResponseBody update_earning_rule(campaign_id, earning_rule_id, loyalties_earning_rules_update_request_body=loyalties_earning_rules_update_request_body) + +Update Earning Rule + +Update an earning rule definition. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_earning_rules_update_request_body import LoyaltiesEarningRulesUpdateRequestBody +from voucherify.models.loyalties_earning_rules_update_response_body import LoyaltiesEarningRulesUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + earning_rule_id = 'earning_rule_id_example' # str | A unique earning rule ID. + loyalties_earning_rules_update_request_body = {"validation_rule_id":"val_7SxpdhPeBngA","loyalty":{"type":"FIXED","points":"5"},"source":{"banner":"Order paid 5 points."},"active":true,"start_date":"2022-11-02T13:00:00.000Z","expiration_date":"2023-03-03T14:30:00.000Z","validity_timeframe":{"duration":"PT1H","interval":"P1D"},"validity_day_of_week":[0,1,2,3,4,5],"metadata":{"Type":"Order paid - fixed amount of points"}} # LoyaltiesEarningRulesUpdateRequestBody | Specify the parameters that you would like to update for the given earning rule. (optional) + + try: + # Update Earning Rule + api_response = api_instance.update_earning_rule(campaign_id, earning_rule_id, loyalties_earning_rules_update_request_body=loyalties_earning_rules_update_request_body) + print("The response of LoyaltiesApi->update_earning_rule:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->update_earning_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **earning_rule_id** | **str**| A unique earning rule ID. | + **loyalties_earning_rules_update_request_body** | [**LoyaltiesEarningRulesUpdateRequestBody**](LoyaltiesEarningRulesUpdateRequestBody.md)| Specify the parameters that you would like to update for the given earning rule. | [optional] + +### Return type + +[**LoyaltiesEarningRulesUpdateResponseBody**](LoyaltiesEarningRulesUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the updated earning rule object. | - | + +[[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) + +# **update_loyalty_card_balance** +> LoyaltiesMembersBalanceUpdateResponseBody update_loyalty_card_balance(member_id, loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body) + +Add or Remove Loyalty Card Balance + +This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_balance_update_request_body import LoyaltiesMembersBalanceUpdateRequestBody +from voucherify.models.loyalties_members_balance_update_response_body import LoyaltiesMembersBalanceUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + member_id = 'member_id_example' # str | Unique loyalty card assigned to a particular customer. + loyalties_members_balance_update_request_body = {"points":-100} # LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. (optional) + + try: + # Add or Remove Loyalty Card Balance + api_response = api_instance.update_loyalty_card_balance(member_id, loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body) + print("The response of LoyaltiesApi->update_loyalty_card_balance:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->update_loyalty_card_balance: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **member_id** | **str**| Unique loyalty card assigned to a particular customer. | + **loyalties_members_balance_update_request_body** | [**LoyaltiesMembersBalanceUpdateRequestBody**](LoyaltiesMembersBalanceUpdateRequestBody.md)| Specify the point adjustment along with the expiration mechanism. | [optional] + +### Return type + +[**LoyaltiesMembersBalanceUpdateResponseBody**](LoyaltiesMembersBalanceUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a balance object. | - | + +[[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) + +# **update_loyalty_card_balance1** +> LoyaltiesMembersBalanceUpdateResponseBody update_loyalty_card_balance1(campaign_id, member_id, loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body) + +Add or Remove Loyalty Card Balance + +This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_members_balance_update_request_body import LoyaltiesMembersBalanceUpdateRequestBody +from voucherify.models.loyalties_members_balance_update_response_body import LoyaltiesMembersBalanceUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID. + member_id = 'member_id_example' # str | A code that identifies the loyalty card. + loyalties_members_balance_update_request_body = {"points":100,"expiration_type":"CUSTOM_DATE","expiration_date":"2023-05-30"} # LoyaltiesMembersBalanceUpdateRequestBody | Specify the point adjustment along with the expiration mechanism. (optional) + + try: + # Add or Remove Loyalty Card Balance + api_response = api_instance.update_loyalty_card_balance1(campaign_id, member_id, loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body) + print("The response of LoyaltiesApi->update_loyalty_card_balance1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->update_loyalty_card_balance1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID. | + **member_id** | **str**| A code that identifies the loyalty card. | + **loyalties_members_balance_update_request_body** | [**LoyaltiesMembersBalanceUpdateRequestBody**](LoyaltiesMembersBalanceUpdateRequestBody.md)| Specify the point adjustment along with the expiration mechanism. | [optional] + +### Return type + +[**LoyaltiesMembersBalanceUpdateResponseBody**](LoyaltiesMembersBalanceUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a balance object. | - | + +[[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) + +# **update_loyalty_program** +> LoyaltiesUpdateCampaignResponseBody update_loyalty_program(campaign_id, loyalties_update_campaign_request_body=loyalties_update_campaign_request_body) + +Update Loyalty Campaign + +Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_update_campaign_request_body import LoyaltiesUpdateCampaignRequestBody +from voucherify.models.loyalties_update_campaign_response_body import LoyaltiesUpdateCampaignResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + loyalties_update_campaign_request_body = {"description":"This is a campaign description. Updated","auto_join":false,"join_once":false,"start_date":"2013-10-26T00:00:00Z","expiration_date":"2025-10-26T00:00:00Z","validity_timeframe":{"duration":"PT2H","interval":"P2D"},"validity_day_of_week":[0,1,2,3,4,5,6],"activity_duration_after_publishing":"P25D","category_id":"cat_0b6152ce12414820dd","loyalty_card":{"points":1,"expiration_rules":{"period_type":"MONTH","period_value":4,"rounding_type":"END_OF_YEAR"}},"metadata":{"test":false},"type":"AUTO_UPDATE","loyalty_tiers_expiration":{"qualification_type":"BALANCE","start_date":{"type":"IMMEDIATE"},"expiration_date":{"type":"CUSTOM","extend":"P4M","rounding":{"type":"CUSTOM","unit":"MONTH","value":1}}}} # LoyaltiesUpdateCampaignRequestBody | Specify the new values for the parameters that you would like to update for the given loyalty campaign. (optional) + + try: + # Update Loyalty Campaign + api_response = api_instance.update_loyalty_program(campaign_id, loyalties_update_campaign_request_body=loyalties_update_campaign_request_body) + print("The response of LoyaltiesApi->update_loyalty_program:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->update_loyalty_program: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **loyalties_update_campaign_request_body** | [**LoyaltiesUpdateCampaignRequestBody**](LoyaltiesUpdateCampaignRequestBody.md)| Specify the new values for the parameters that you would like to update for the given loyalty campaign. | [optional] + +### Return type + +[**LoyaltiesUpdateCampaignResponseBody**](LoyaltiesUpdateCampaignResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the loyalty campaign object if the update succeeded. | - | + +[[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) + +# **update_reward_assignment1** +> LoyaltiesRewardsUpdateAssignmentResponseBody update_reward_assignment1(campaign_id, assignment_id, loyalties_rewards_update_assignment_request_body=loyalties_rewards_update_assignment_request_body) + +Update Reward Assignment + +Updates rewards parameters, i.e. the points cost for the specific reward. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.loyalties_rewards_update_assignment_request_body import LoyaltiesRewardsUpdateAssignmentRequestBody +from voucherify.models.loyalties_rewards_update_assignment_response_body import LoyaltiesRewardsUpdateAssignmentResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.LoyaltiesApi(api_client) + campaign_id = 'campaign_id_example' # str | The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. + loyalties_rewards_update_assignment_request_body = {"parameters":{"loyalty":{"points":3}}} # LoyaltiesRewardsUpdateAssignmentRequestBody | Update the points cost for the reward assignment. (optional) + + try: + # Update Reward Assignment + api_response = api_instance.update_reward_assignment1(campaign_id, assignment_id, loyalties_rewards_update_assignment_request_body=loyalties_rewards_update_assignment_request_body) + print("The response of LoyaltiesApi->update_reward_assignment1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling LoyaltiesApi->update_reward_assignment1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. | + **assignment_id** | **str**| A unique reward assignment ID. | + **loyalties_rewards_update_assignment_request_body** | [**LoyaltiesRewardsUpdateAssignmentRequestBody**](LoyaltiesRewardsUpdateAssignmentRequestBody.md)| Update the points cost for the reward assignment. | [optional] + +### Return type + +[**LoyaltiesRewardsUpdateAssignmentResponseBody**](LoyaltiesRewardsUpdateAssignmentResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a reward assignment with an updated points value. | - | + +[[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) + diff --git a/docs/LoyaltiesCreateCampaignRequestBody.md b/docs/LoyaltiesCreateCampaignRequestBody.md new file mode 100644 index 00000000..3b3cd45e --- /dev/null +++ b/docs/LoyaltiesCreateCampaignRequestBody.md @@ -0,0 +1,31 @@ +# LoyaltiesCreateCampaignRequestBody + +Request body schema for **POST** `/loyalties`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign (size of campaign). | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**validation_rules** | **List[str]** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**category** | **str** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**voucher** | [**CampaignLoyaltyVoucher**](CampaignLoyaltyVoucher.md) | | [optional] + +[[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/LoyaltiesCreateCampaignResponseBody.md b/docs/LoyaltiesCreateCampaignResponseBody.md new file mode 100644 index 00000000..5eb58828 --- /dev/null +++ b/docs/LoyaltiesCreateCampaignResponseBody.md @@ -0,0 +1,42 @@ +# LoyaltiesCreateCampaignResponseBody + +Response body schema for **POST** `/loyalties`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] + +[[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/LoyaltiesDeleteResponseBody.md b/docs/LoyaltiesDeleteResponseBody.md new file mode 100644 index 00000000..0bd9abde --- /dev/null +++ b/docs/LoyaltiesDeleteResponseBody.md @@ -0,0 +1,13 @@ +# LoyaltiesDeleteResponseBody + +Response body schema for **DELETE** `/loyalties/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItem.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItem.md new file mode 100644 index 00000000..0dd5388e --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItem.md @@ -0,0 +1,25 @@ +# LoyaltiesEarningRulesCreateRequestBodyItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyalty**](LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md) | | [optional] +**event** | **str** | | [optional] +**source** | [**LoyaltiesEarningRulesCreateRequestBodyItemSource**](LoyaltiesEarningRulesCreateRequestBodyItemSource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**start_date** | **datetime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expiration_date** | **datetime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | | [optional] +**segment** | [**LoyaltiesEarningRulesCreateRequestBodyItemSegment**](LoyaltiesEarningRulesCreateRequestBodyItemSegment.md) | | [optional] +**custom_event** | [**LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent**](LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md) | | [optional] +**loyalty_tier** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md new file mode 100644 index 00000000..37c72c4e --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent + +Contains the schema id of a custom event. **Required** for the custom event option in `event`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **str** | Contains a unique identifier of a custom event schema. Assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md new file mode 100644 index 00000000..ff52dab7 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.md @@ -0,0 +1,18 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] +**calculation_type** | **str** | | [optional] +**custom_event** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md) | | [optional] +**order_items** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md) | | [optional] +**order** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md) | | [optional] +**customer** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md new file mode 100644 index 00000000..f1061382 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..81314120 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md new file mode 100644 index 00000000..2544d80f --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..b52d5fc5 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md new file mode 100644 index 00000000..dde4f1ba --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md new file mode 100644 index 00000000..a5ea7b38 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md new file mode 100644 index 00000000..bd68ed9a --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..793ac4ff --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..4adf4e50 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..403a5e0a --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md new file mode 100644 index 00000000..5c34a0fe --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..c18d8c68 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md new file mode 100644 index 00000000..d8f71eba --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier + +Defines the tier associated with the earning rule definition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md new file mode 100644 index 00000000..ef6942b0 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSegment.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemSegment + +Contains the ID of a customer segment. **Required** for the `customer.segment.entered` option in `event`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesEarningRulesCreateRequestBodyItemSource.md b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSource.md new file mode 100644 index 00000000..66427803 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateRequestBodyItemSource.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesCreateRequestBodyItemSource + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBody.md b/docs/LoyaltiesEarningRulesCreateResponseBody.md new file mode 100644 index 00000000..bb031f2a --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBody.md @@ -0,0 +1,31 @@ +# LoyaltiesEarningRulesCreateResponseBody + +Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**LoyaltiesEarningRulesCreateResponseBodyLoyalty**](LoyaltiesEarningRulesCreateResponseBodyLoyalty.md) | | [optional] +**event** | **str** | | [optional] +**custom_event** | [**LoyaltiesEarningRulesCreateResponseBodyCustomEvent**](LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md) | | [optional] +**segment** | [**LoyaltiesEarningRulesCreateResponseBodySegment**](LoyaltiesEarningRulesCreateResponseBodySegment.md) | | [optional] +**loyalty_tier** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**LoyaltiesEarningRulesCreateResponseBodySource**](LoyaltiesEarningRulesCreateResponseBodySource.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automation_id** | **str** | For internal use by Voucherify. | [optional] +**start_date** | **str** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expiration_date** | **str** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md new file mode 100644 index 00000000..ad17a545 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyCustomEvent.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesCreateResponseBodyCustomEvent + +Contains details about the custom event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **str** | Unique identifier of the custom event schema | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md new file mode 100644 index 00000000..ec725780 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyalty.md @@ -0,0 +1,18 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**calculation_type** | **str** | | [optional] +**order** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md) | | [optional] +**order_items** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md) | | [optional] +**custom_event** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..01df140e --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..aca66fa1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..ff692b4a --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..b101a886 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..df9341c8 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..10b32147 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..736cdaad --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..1ef4d012 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..dadf5483 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..dcbcbf64 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..0df4a20f --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..ba2d2089 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..833c0586 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier + +Defines the tier associated with the earning rule definition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodySegment.md b/docs/LoyaltiesEarningRulesCreateResponseBodySegment.md new file mode 100644 index 00000000..bba73e56 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodySegment.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesCreateResponseBodySegment + +Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesEarningRulesCreateResponseBodySource.md b/docs/LoyaltiesEarningRulesCreateResponseBodySource.md new file mode 100644 index 00000000..1c16f093 --- /dev/null +++ b/docs/LoyaltiesEarningRulesCreateResponseBodySource.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesCreateResponseBodySource + +Contains the custom earning rule name and parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**object_id** | **str** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**object_type** | **str** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[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/LoyaltiesEarningRulesDisableResponseBody.md b/docs/LoyaltiesEarningRulesDisableResponseBody.md new file mode 100644 index 00000000..2743b172 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBody.md @@ -0,0 +1,30 @@ +# LoyaltiesEarningRulesDisableResponseBody + +Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**LoyaltiesEarningRulesDisableResponseBodyLoyalty**](LoyaltiesEarningRulesDisableResponseBodyLoyalty.md) | | [optional] +**event** | **str** | | [optional] +**custom_event** | [**LoyaltiesEarningRulesDisableResponseBodyCustomEvent**](LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md) | | [optional] +**segment** | [**LoyaltiesEarningRulesDisableResponseBodySegment**](LoyaltiesEarningRulesDisableResponseBodySegment.md) | | [optional] +**loyalty_tier** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**LoyaltiesEarningRulesDisableResponseBodySource**](LoyaltiesEarningRulesDisableResponseBodySource.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automation_id** | **str** | For internal use by Voucherify. | [optional] +**start_date** | **str** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expiration_date** | **str** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [optional] [default to False] + +[[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/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md new file mode 100644 index 00000000..f7673bf8 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyCustomEvent.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesDisableResponseBodyCustomEvent + +Contains details about the custom event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **str** | Unique identifier of the custom event schema | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md new file mode 100644 index 00000000..7bf98f54 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyalty.md @@ -0,0 +1,18 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**calculation_type** | **str** | | [optional] +**order** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md) | | [optional] +**order_items** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md) | | [optional] +**custom_event** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..81feee17 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..ede04bea --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..9cbf250f --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..9b6d9c6f --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..1890aca1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..1876c248 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..fd0f260d --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..08d9e9eb --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..d81c02fe --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..60a2c750 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..849de740 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..1d0a821f --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..8bc90ed4 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier + +Defines the tier associated with the earning rule definition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodySegment.md b/docs/LoyaltiesEarningRulesDisableResponseBodySegment.md new file mode 100644 index 00000000..5cbda609 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodySegment.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesDisableResponseBodySegment + +Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesEarningRulesDisableResponseBodySource.md b/docs/LoyaltiesEarningRulesDisableResponseBodySource.md new file mode 100644 index 00000000..79340aa7 --- /dev/null +++ b/docs/LoyaltiesEarningRulesDisableResponseBodySource.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesDisableResponseBodySource + +Contains the custom earning rule name and parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**object_id** | **str** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**object_type** | **str** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[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/LoyaltiesEarningRulesEnableResponseBody.md b/docs/LoyaltiesEarningRulesEnableResponseBody.md new file mode 100644 index 00000000..884069f4 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBody.md @@ -0,0 +1,30 @@ +# LoyaltiesEarningRulesEnableResponseBody + +Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**LoyaltiesEarningRulesEnableResponseBodyLoyalty**](LoyaltiesEarningRulesEnableResponseBodyLoyalty.md) | | [optional] +**event** | **str** | | [optional] +**custom_event** | [**LoyaltiesEarningRulesEnableResponseBodyCustomEvent**](LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md) | | [optional] +**segment** | [**LoyaltiesEarningRulesEnableResponseBodySegment**](LoyaltiesEarningRulesEnableResponseBodySegment.md) | | [optional] +**loyalty_tier** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**LoyaltiesEarningRulesEnableResponseBodySource**](LoyaltiesEarningRulesEnableResponseBodySource.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automation_id** | **str** | For internal use by Voucherify. | [optional] +**start_date** | **str** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expiration_date** | **str** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. | [optional] [default to True] + +[[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/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md new file mode 100644 index 00000000..c4ec3414 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyCustomEvent.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesEnableResponseBodyCustomEvent + +Contains details about the custom event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **str** | Unique identifier of the custom event schema | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md new file mode 100644 index 00000000..4459246e --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyalty.md @@ -0,0 +1,18 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**calculation_type** | **str** | | [optional] +**order** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md) | | [optional] +**order_items** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md) | | [optional] +**custom_event** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..189340ab --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..1842eb13 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..64606c50 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..ec642965 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..ce1445bf --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..f5767c30 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..ccbc02b5 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..3e8001b2 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..5c68e631 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..f309bfc9 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..956be923 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..e6c87b2c --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..54653b5d --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier + +Defines the tier associated with the earning rule definition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodySegment.md b/docs/LoyaltiesEarningRulesEnableResponseBodySegment.md new file mode 100644 index 00000000..60c540f6 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodySegment.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesEnableResponseBodySegment + +Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesEarningRulesEnableResponseBodySource.md b/docs/LoyaltiesEarningRulesEnableResponseBodySource.md new file mode 100644 index 00000000..b9fa4e49 --- /dev/null +++ b/docs/LoyaltiesEarningRulesEnableResponseBodySource.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesEnableResponseBodySource + +Contains the custom earning rule name and parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**object_id** | **str** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**object_type** | **str** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[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/LoyaltiesEarningRulesGetResponseBody.md b/docs/LoyaltiesEarningRulesGetResponseBody.md new file mode 100644 index 00000000..aa7e57bb --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBody.md @@ -0,0 +1,31 @@ +# LoyaltiesEarningRulesGetResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**LoyaltiesEarningRulesGetResponseBodyLoyalty**](LoyaltiesEarningRulesGetResponseBodyLoyalty.md) | | [optional] +**event** | **str** | | [optional] +**custom_event** | [**LoyaltiesEarningRulesGetResponseBodyCustomEvent**](LoyaltiesEarningRulesGetResponseBodyCustomEvent.md) | | [optional] +**segment** | [**LoyaltiesEarningRulesGetResponseBodySegment**](LoyaltiesEarningRulesGetResponseBodySegment.md) | | [optional] +**loyalty_tier** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyTier**](LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**LoyaltiesEarningRulesGetResponseBodySource**](LoyaltiesEarningRulesGetResponseBodySource.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automation_id** | **str** | For internal use by Voucherify. | [optional] +**start_date** | **str** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expiration_date** | **str** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md new file mode 100644 index 00000000..979c2c14 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyCustomEvent.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesGetResponseBodyCustomEvent + +Contains details about the custom event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **str** | Unique identifier of the custom event schema | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md new file mode 100644 index 00000000..064dd615 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyalty.md @@ -0,0 +1,18 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**calculation_type** | **str** | | [optional] +**order** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md) | | [optional] +**order_items** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md) | | [optional] +**custom_event** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..983d8cd8 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..7bf14c16 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..4e228ef5 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..bc90fee5 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..32789e5f --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..14befcc1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..34fc6b4d --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..91d209d9 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..42c75ab4 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..b446c7b0 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..e65fa0ca --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..ecbcad71 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..b9a1660c --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesGetResponseBodyLoyaltyTier + +Defines the tier associated with the earning rule definition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodySegment.md b/docs/LoyaltiesEarningRulesGetResponseBodySegment.md new file mode 100644 index 00000000..cb44cd44 --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodySegment.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesGetResponseBodySegment + +Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesEarningRulesGetResponseBodySource.md b/docs/LoyaltiesEarningRulesGetResponseBodySource.md new file mode 100644 index 00000000..1790de8a --- /dev/null +++ b/docs/LoyaltiesEarningRulesGetResponseBodySource.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesGetResponseBodySource + +Contains the custom earning rule name and parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**object_id** | **str** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**object_type** | **str** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[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/LoyaltiesEarningRulesListResponseBody.md b/docs/LoyaltiesEarningRulesListResponseBody.md new file mode 100644 index 00000000..28aad263 --- /dev/null +++ b/docs/LoyaltiesEarningRulesListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesListResponseBody + +Response body schema for listing earning rules using **GET** `v1/loyalties/{campaignId}/earning-rules` endpoint. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about earning rules in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of earning rule objects. | [optional] [default to 'data'] +**data** | [**List[EarningRule]**](EarningRule.md) | Contains array of earning rule objects. | [optional] +**total** | **int** | Total number of earning rule objects. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBody.md b/docs/LoyaltiesEarningRulesUpdateRequestBody.md new file mode 100644 index 00000000..85d9785b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBody.md @@ -0,0 +1,21 @@ +# LoyaltiesEarningRulesUpdateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**loyalty** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyalty**](LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md) | | [optional] +**source** | [**LoyaltiesEarningRulesUpdateRequestBodySource**](LoyaltiesEarningRulesUpdateRequestBodySource.md) | | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule | [optional] +**start_date** | **datetime** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. | [optional] +**expiration_date** | **datetime** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md new file mode 100644 index 00000000..37b42a46 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyalty.md @@ -0,0 +1,18 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**calculation_type** | **str** | | [optional] +**order** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md) | | [optional] +**order_items** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md) | | [optional] +**custom_event** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..c80ae567 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..f5fc8c0a --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md new file mode 100644 index 00000000..fc025d1b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..4e78320b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md new file mode 100644 index 00000000..ddce8831 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..598dc1f7 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..1ee7f4f2 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..dcb3bbf4 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..420ec231 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..105da95c --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..1efc4582 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..29746076 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesUpdateRequestBodySource.md b/docs/LoyaltiesEarningRulesUpdateRequestBodySource.md new file mode 100644 index 00000000..cbadef7b --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateRequestBodySource.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesUpdateRequestBodySource + +Contains the custom earning rule name and parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBody.md b/docs/LoyaltiesEarningRulesUpdateResponseBody.md new file mode 100644 index 00000000..51ceea62 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBody.md @@ -0,0 +1,31 @@ +# LoyaltiesEarningRulesUpdateResponseBody + +Response body schema for **PUT** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the earning rule object. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. | [optional] +**loyalty** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyalty**](LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md) | | [optional] +**event** | **str** | | [optional] +**custom_event** | [**LoyaltiesEarningRulesUpdateResponseBodyCustomEvent**](LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md) | | [optional] +**segment** | [**LoyaltiesEarningRulesUpdateResponseBodySegment**](LoyaltiesEarningRulesUpdateResponseBodySegment.md) | | [optional] +**loyalty_tier** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md) | | [optional] +**source** | [**LoyaltiesEarningRulesUpdateResponseBodySource**](LoyaltiesEarningRulesUpdateResponseBodySource.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. Default is earning_rule. | [optional] [default to 'earning_rule'] +**automation_id** | **str** | For internal use by Voucherify. | [optional] +**start_date** | **str** | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. | [optional] +**expiration_date** | **str** | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. | [optional] +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. | [optional] +**active** | **bool** | A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md new file mode 100644 index 00000000..853d8ff5 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesUpdateResponseBodyCustomEvent + +Contains details about the custom event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**schema_id** | **str** | Unique identifier of the custom event schema | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md new file mode 100644 index 00000000..adb954c1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyalty.md @@ -0,0 +1,18 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyalty + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**calculation_type** | **str** | | [optional] +**order** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md) | | [optional] +**order_items** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md) | | [optional] +**customer** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md) | | [optional] +**custom_event** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md) | | [optional] +**points** | **int** | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md new file mode 100644 index 00000000..521eecc1 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md new file mode 100644 index 00000000..2564b524 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Custom event metadata property. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md new file mode 100644 index 00000000..347a68ef --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.md @@ -0,0 +1,12 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md new file mode 100644 index 00000000..cf1d6f2f --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the customer metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Customer metadata property. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md new file mode 100644 index 00000000..0c2555ee --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md) | | [optional] +**total_amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md) | | [optional] +**metadata** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md new file mode 100644 index 00000000..b3c91a35 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md new file mode 100644 index 00000000..1ffd61b7 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md) | | [optional] +**amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md) | | [optional] +**subtotal_amount** | [**LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount**](LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md) | | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md new file mode 100644 index 00000000..6dcef1e3 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md new file mode 100644 index 00000000..70c9c537 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md new file mode 100644 index 00000000..99a84f34 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.md @@ -0,0 +1,16 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**object** | **str** | Type of object taken under consideration. | [optional] +**id** | **str** | Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md new file mode 100644 index 00000000..95b1fc51 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata + +Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | For how many increments of the order metadata property to grant points for. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] +**var_property** | **str** | Order metadata property. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md new file mode 100644 index 00000000..eeeb6d51 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.md @@ -0,0 +1,14 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount + +Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**every** | **int** | Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. | [optional] +**points** | **int** | Number of points to be awarded, i.e. how many points to be added to the loyalty card. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md new file mode 100644 index 00000000..f00e82d9 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier + +Defines the tier associated with the earning rule definition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodySegment.md b/docs/LoyaltiesEarningRulesUpdateResponseBodySegment.md new file mode 100644 index 00000000..2ac70ecc --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodySegment.md @@ -0,0 +1,13 @@ +# LoyaltiesEarningRulesUpdateResponseBodySegment + +Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Contains a unique identifier of a customer segment. Assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesEarningRulesUpdateResponseBodySource.md b/docs/LoyaltiesEarningRulesUpdateResponseBodySource.md new file mode 100644 index 00000000..0a4f1c54 --- /dev/null +++ b/docs/LoyaltiesEarningRulesUpdateResponseBodySource.md @@ -0,0 +1,15 @@ +# LoyaltiesEarningRulesUpdateResponseBodySource + +Contains the custom earning rule name and parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**object_id** | **str** | A unique campaign identifier assigned by the Voucherify API. | [optional] +**object_type** | **str** | Defines the object associated with the earning rule. Defaults to `campaign`. | [optional] [default to 'campaign'] + +[[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/LoyaltiesGetCampaignResponseBody.md b/docs/LoyaltiesGetCampaignResponseBody.md new file mode 100644 index 00000000..57c4c116 --- /dev/null +++ b/docs/LoyaltiesGetCampaignResponseBody.md @@ -0,0 +1,42 @@ +# LoyaltiesGetCampaignResponseBody + +Response body schema for **GET** `/loyalties/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] + +[[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/LoyaltiesListCampaignsResponseBody.md b/docs/LoyaltiesListCampaignsResponseBody.md new file mode 100644 index 00000000..8b790312 --- /dev/null +++ b/docs/LoyaltiesListCampaignsResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesListCampaignsResponseBody + +Response body schema for **Get** `/loyalties`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about loyalty campaigns in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of loyalty campaign objects. | [optional] [default to 'campaigns'] +**campaigns** | [**List[LoyaltyCampaign]**](LoyaltyCampaign.md) | Contains an array of loyalty campaign objects. | [optional] +**total** | **int** | Total number of loyalty campaign objects. | [optional] + +[[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/LoyaltiesListMembersResponseBody.md b/docs/LoyaltiesListMembersResponseBody.md new file mode 100644 index 00000000..9ed2f2f9 --- /dev/null +++ b/docs/LoyaltiesListMembersResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesListMembersResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/members`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about members in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of voucher objects. | [optional] [default to 'vouchers'] +**vouchers** | [**List[LoyaltyMember]**](LoyaltyMember.md) | Contains array of voucher objects representing loyalty cards, in other words, loyalty program members. | [optional] +**total** | **int** | Total number of voucher objects. | [optional] + +[[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/LoyaltiesLoyaltyTierReward.md b/docs/LoyaltiesLoyaltyTierReward.md new file mode 100644 index 00000000..92526fe9 --- /dev/null +++ b/docs/LoyaltiesLoyaltyTierReward.md @@ -0,0 +1,15 @@ +# LoyaltiesLoyaltyTierReward + +This is an object representing a loyalty tier reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | [**Reward**](Reward.md) | | +**assignment** | [**RewardAssignment**](RewardAssignment.md) | | +**object** | **str** | The type of the object represented by JSON. This object stores information about the loyalty tier reward. | [default to 'loyalty_tier_reward'] + +[[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/LoyaltiesMemberActivityListResponseBody.md b/docs/LoyaltiesMemberActivityListResponseBody.md new file mode 100644 index 00000000..81e0f041 --- /dev/null +++ b/docs/LoyaltiesMemberActivityListResponseBody.md @@ -0,0 +1,17 @@ +# LoyaltiesMemberActivityListResponseBody + +Response body schema for retrieving member activity. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about member activities in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of member activity objects. | [optional] [default to 'data'] +**data** | [**List[MemberActivity]**](MemberActivity.md) | Array of member activity objects. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results. | [optional] +**more_starting_after** | **str** | Returns an ID that can be used to return another page of results. Use the event ID in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID. | [optional] + +[[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/LoyaltiesMembersBalanceUpdateRequestBody.md b/docs/LoyaltiesMembersBalanceUpdateRequestBody.md new file mode 100644 index 00000000..9ad6854e --- /dev/null +++ b/docs/LoyaltiesMembersBalanceUpdateRequestBody.md @@ -0,0 +1,17 @@ +# LoyaltiesMembersBalanceUpdateRequestBody + +Request Body schema for **POST** `v1/loyalties/members/{memberId}/balance` and **POST** `v1/loyalties/{campaignId}/members/{memberId}/balance`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Incremental balance to be added to/subtracted from the loyalty card. - To add points: 100 - To subtract points, add a minus: -100 | [optional] +**expiration_type** | [**PointsExpirationTypes**](PointsExpirationTypes.md) | | [optional] +**expiration_date** | **datetime** | Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`. | [optional] +**reason** | **str** | Reason for the transfer. | [optional] +**source_id** | **str** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] + +[[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/LoyaltiesMembersBalanceUpdateResponseBody.md b/docs/LoyaltiesMembersBalanceUpdateResponseBody.md new file mode 100644 index 00000000..698a0a30 --- /dev/null +++ b/docs/LoyaltiesMembersBalanceUpdateResponseBody.md @@ -0,0 +1,19 @@ +# LoyaltiesMembersBalanceUpdateResponseBody + +Response schema for **POST** `v1/loyalties/members/{memberId}/balance` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/balance`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The incremental points removed or added to the current balance on the loyalty card. | [optional] +**total** | **int** | The total of points accrued over the lifetime of the loyalty card. | [optional] +**balance** | **int** | The balance after adding/removing points. | [optional] +**type** | **str** | The type of voucher being modified. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is balance. | [optional] [default to 'balance'] +**related_object** | [**LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject**](LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md) | | [optional] +**operation_type** | **str** | | [optional] + +[[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/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md b/docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md new file mode 100644 index 00000000..af2c0d0c --- /dev/null +++ b/docs/LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.md @@ -0,0 +1,14 @@ +# LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject + +Defines the object that is being modified with the values that are returned in the balance object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The object being modified. | [optional] [default to 'voucher'] +**id** | **str** | Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] + +[[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/LoyaltiesMembersCreateRequestBody.md b/docs/LoyaltiesMembersCreateRequestBody.md new file mode 100644 index 00000000..f8c6fc7c --- /dev/null +++ b/docs/LoyaltiesMembersCreateRequestBody.md @@ -0,0 +1,17 @@ +# LoyaltiesMembersCreateRequestBody + +Request body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucher** | **str** | Code of voucher being published. | [optional] +**source_id** | **str** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] +**channel** | **str** | Specify the distribution channel. | [optional] + +[[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/LoyaltiesMembersCreateResponseBody.md b/docs/LoyaltiesMembersCreateResponseBody.md new file mode 100644 index 00000000..2b7acccc --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBody.md @@ -0,0 +1,38 @@ +# LoyaltiesMembersCreateResponseBody + +Respone body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**discount** | **object** | | [optional] +**gift** | **object** | | [optional] +**loyalty_card** | [**LoyaltiesMembersCreateResponseBodyLoyaltyCard**](LoyaltiesMembersCreateResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | This is always false for loyalty members. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique identifier of the customer who owns the voucher. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**LoyaltiesMembersCreateResponseBodyPublish**](LoyaltiesMembersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**LoyaltiesMembersCreateResponseBodyRedemption**](LoyaltiesMembersCreateResponseBodyRedemption.md) | | [optional] + +[[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/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..f0e8487d --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersCreateResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/LoyaltiesMembersCreateResponseBodyPublish.md b/docs/LoyaltiesMembersCreateResponseBodyPublish.md new file mode 100644 index 00000000..460afd67 --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBodyPublish.md @@ -0,0 +1,15 @@ +# LoyaltiesMembersCreateResponseBodyPublish + +This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication event counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/LoyaltiesMembersCreateResponseBodyRedemption.md b/docs/LoyaltiesMembersCreateResponseBodyRedemption.md new file mode 100644 index 00000000..c7e0eb26 --- /dev/null +++ b/docs/LoyaltiesMembersCreateResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# LoyaltiesMembersCreateResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/LoyaltiesMembersGetResponseBody.md b/docs/LoyaltiesMembersGetResponseBody.md new file mode 100644 index 00000000..48a3864e --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBody.md @@ -0,0 +1,38 @@ +# LoyaltiesMembersGetResponseBody + +Response body schema for **GET** `/loyalties/{campaignId}/members/{memberId}` and **GET** `/loyalties/members/{memberId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**discount** | **object** | | [optional] +**gift** | **object** | | [optional] +**loyalty_card** | [**LoyaltiesMembersGetResponseBodyLoyaltyCard**](LoyaltiesMembersGetResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | This is always false for loyalty members. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique identifier of the customer who owns the voucher. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**LoyaltiesMembersGetResponseBodyPublish**](LoyaltiesMembersGetResponseBodyPublish.md) | | [optional] +**redemption** | [**LoyaltiesMembersGetResponseBodyRedemption**](LoyaltiesMembersGetResponseBodyRedemption.md) | | [optional] + +[[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/LoyaltiesMembersGetResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..d200a47d --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersGetResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/LoyaltiesMembersGetResponseBodyPublish.md b/docs/LoyaltiesMembersGetResponseBodyPublish.md new file mode 100644 index 00000000..7100d71b --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBodyPublish.md @@ -0,0 +1,15 @@ +# LoyaltiesMembersGetResponseBodyPublish + +This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication event counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/LoyaltiesMembersGetResponseBodyRedemption.md b/docs/LoyaltiesMembersGetResponseBodyRedemption.md new file mode 100644 index 00000000..cc7afcb0 --- /dev/null +++ b/docs/LoyaltiesMembersGetResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# LoyaltiesMembersGetResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/LoyaltiesMembersPointsExpirationListResponseBody.md b/docs/LoyaltiesMembersPointsExpirationListResponseBody.md new file mode 100644 index 00000000..21caa95d --- /dev/null +++ b/docs/LoyaltiesMembersPointsExpirationListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersPointsExpirationListResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/members/{memberId}/points-expiration`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects. | [optional] [default to 'data'] +**data** | [**List[LoyaltiesMembersPointsExpirationListResponseBodyDataItem]**](LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md) | Contains array of loyalty points expiration buckets. | [optional] +**total** | **int** | Total number of point expiration buckets. | [optional] + +[[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/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md b/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md new file mode 100644 index 00000000..d73b9fb8 --- /dev/null +++ b/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItem.md @@ -0,0 +1,20 @@ +# LoyaltiesMembersPointsExpirationListResponseBodyDataItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique loyalty points bucket ID. | +**voucher_id** | **str** | Unique parent loyalty card ID. | +**campaign_id** | **str** | Unique parent campaign ID. | +**bucket** | [**LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket**](LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md) | | +**created_at** | **datetime** | Timestamp representing the date and time when the loyalty points bucket object was created. The value is shown in the ISO 8601 format. | +**status** | **str** | Loyalty points bucket point status. | +**expires_at** | **datetime** | Date when the number of points defined in the bucket object are due to expire. | +**updated_at** | **datetime** | Timestamp representing the date and time when the loyalty points bucket object was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the loyalty points bucket. | [default to 'loyalty_points_bucket'] + +[[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/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md b/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md new file mode 100644 index 00000000..a36fe85e --- /dev/null +++ b/docs/LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.md @@ -0,0 +1,13 @@ +# LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket + +Defines the number of points stored in the given loyalty points bucket. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_points** | **int** | Total number of points in the loyalty points bucket. | + +[[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/LoyaltiesMembersRedemptionRedeemRequestBody.md b/docs/LoyaltiesMembersRedemptionRedeemRequestBody.md new file mode 100644 index 00000000..33e38132 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemRequestBody.md @@ -0,0 +1,15 @@ +# LoyaltiesMembersRedemptionRedeemRequestBody + +Request body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** `v1/loyalties/members/{memberId}/redemption`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | [**LoyaltiesMembersRedemptionRedeemRequestBodyReward**](LoyaltiesMembersRedemptionRedeemRequestBodyReward.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to check against vouchers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md b/docs/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md new file mode 100644 index 00000000..2b09aedc --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemRequestBodyReward.md @@ -0,0 +1,14 @@ +# LoyaltiesMembersRedemptionRedeemRequestBodyReward + +Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward if the reward is a pay with points reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBody.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBody.md new file mode 100644 index 00000000..e4540ddc --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBody.md @@ -0,0 +1,35 @@ +# LoyaltiesMembersRedemptionRedeemResponseBody + +Response body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** `v1/loyalties/members/{memberId}/redemption`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**object** | **str** | The type of the object represented by the JSON | [optional] [default to 'redemption'] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the redeeming customer. | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. | [optional] +**redemption** | **str** | Unique redemption ID of the parent redemption. | [optional] +**result** | **str** | Redemption result. | [optional] +**status** | **str** | Redemption status. | [optional] +**related_redemptions** | [**LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md) | | [optional] +**failure_code** | **str** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failure_message** | **str** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**LoyaltiesMembersRedemptionRedeemResponseBodyChannel**](LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md) | | [optional] +**customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] +**related_object_type** | **str** | Defines the related object. | [optional] +**related_object_id** | **str** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] +**voucher** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucher**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md) | | [optional] +**promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**LoyaltiesMembersRedemptionRedeemResponseBodyGift**](LoyaltiesMembersRedemptionRedeemResponseBodyGift.md) | | [optional] +**loyalty_card** | [**LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard**](LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md) | | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md new file mode 100644 index 00000000..b324fbec --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md @@ -0,0 +1,14 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyChannel + +Defines the details of the channel through which the redemption was issued. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel_id** | **str** | Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channel_type** | **str** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md new file mode 100644 index 00000000..d72b4415 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyGift.md @@ -0,0 +1,13 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyGift + +Contains the amount subtracted from the gift card for the redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..8890cead --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.md @@ -0,0 +1,13 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard + +Contains the number of points subtracted from the loyalty card for the redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md new file mode 100644 index 00000000..24254a6f --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.md @@ -0,0 +1,13 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem]**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**List[LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem]**](LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md) | | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..c00d71b9 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,13 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..d4c2be4d --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,13 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique rollback redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md new file mode 100644 index 00000000..e461a84c --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.md @@ -0,0 +1,42 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyVoucher + +Defines the details of the voucher being redeemed. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md) | | [optional] +**loyalty_card** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md) | | [optional] +**redemption** | [**LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption**](LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md new file mode 100644 index 00000000..aca63220 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.md @@ -0,0 +1,15 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md new file mode 100644 index 00000000..522f4a0c --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md new file mode 100644 index 00000000..c62e1954 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.md @@ -0,0 +1,15 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md new file mode 100644 index 00000000..614888b1 --- /dev/null +++ b/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.md @@ -0,0 +1,17 @@ +# LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/LoyaltiesMembersRewardsListResponseBody.md b/docs/LoyaltiesMembersRewardsListResponseBody.md new file mode 100644 index 00000000..2734889b --- /dev/null +++ b/docs/LoyaltiesMembersRewardsListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersRewardsListResponseBody + +Response body schema for **GET** `v1/loyalties/members/{memberId}/rewards` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of loyalty reward objects. | [optional] [default to 'data'] +**data** | [**List[LoyaltiesMembersRewardsListResponseBodyDataItem]**](LoyaltiesMembersRewardsListResponseBodyDataItem.md) | Contains array of loyalty reward objects. | [optional] +**total** | **int** | Total number of loyalty reward objects. | [optional] + +[[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/LoyaltiesMembersRewardsListResponseBodyDataItem.md b/docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md new file mode 100644 index 00000000..6690446c --- /dev/null +++ b/docs/LoyaltiesMembersRewardsListResponseBodyDataItem.md @@ -0,0 +1,14 @@ +# LoyaltiesMembersRewardsListResponseBodyDataItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | [**Reward**](Reward.md) | | [optional] +**assignment** | [**RewardAssignment**](RewardAssignment.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'loyalty_reward'] + +[[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/LoyaltiesMembersTiersListResponseBody.md b/docs/LoyaltiesMembersTiersListResponseBody.md new file mode 100644 index 00000000..6ef85783 --- /dev/null +++ b/docs/LoyaltiesMembersTiersListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersTiersListResponseBody + +Response body schema for **GET** `v1/loyalties/members/{memberId}/tiers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [optional] [default to 'data'] +**data** | [**List[LoyaltyTier]**](LoyaltyTier.md) | | [optional] +**total** | **int** | Total number of loyalty tier objects. | [optional] + +[[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/LoyaltiesMembersTransactionsExportCreateRequestBody.md b/docs/LoyaltiesMembersTransactionsExportCreateRequestBody.md new file mode 100644 index 00000000..3139e2f4 --- /dev/null +++ b/docs/LoyaltiesMembersTransactionsExportCreateRequestBody.md @@ -0,0 +1,13 @@ +# LoyaltiesMembersTransactionsExportCreateRequestBody + +Request body schema for **POST** `v1/loyalties/members/{memberId}/transactions/export` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transactions/export`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**LoyaltiesMembersTransactionsExportCreateRequestBodyParameters**](LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md) | | [optional] + +[[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/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md b/docs/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md new file mode 100644 index 00000000..84c3fb01 --- /dev/null +++ b/docs/LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.md @@ -0,0 +1,15 @@ +# LoyaltiesMembersTransactionsExportCreateRequestBodyParameters + +List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | [**ExportVoucherTransactionsOrder**](ExportVoucherTransactionsOrder.md) | | [optional] +**fields** | [**List[ExportVoucherTransactionsFields]**](ExportVoucherTransactionsFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**ExportVoucherTransactionsFilters**](ExportVoucherTransactionsFilters.md) | | [optional] + +[[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/LoyaltiesMembersTransactionsExportCreateResponseBody.md b/docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md new file mode 100644 index 00000000..272abf8b --- /dev/null +++ b/docs/LoyaltiesMembersTransactionsExportCreateResponseBody.md @@ -0,0 +1,21 @@ +# LoyaltiesMembersTransactionsExportCreateResponseBody + +Response body schema for **POST** `v1/loyalties/members/{memberId}/transactions/export` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transactions/export`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique export ID. | [optional] +**object** | **str** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**created_at** | **datetime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **str** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **str** | The channel through which the export was triggered. | [optional] +**result** | **object** | Contains the URL of the CSV file. | [optional] +**user_id** | **str** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exported_object** | **str** | The type of object to be exported. | [optional] [default to 'voucher_transactions'] +**parameters** | [**LoyaltiesMembersTransactionsExportCreateResponseBodyParameters**](LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md) | | [optional] + +[[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/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md b/docs/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md new file mode 100644 index 00000000..e59e6fd9 --- /dev/null +++ b/docs/LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.md @@ -0,0 +1,15 @@ +# LoyaltiesMembersTransactionsExportCreateResponseBodyParameters + +List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | [**ExportVoucherTransactionsOrder**](ExportVoucherTransactionsOrder.md) | | [optional] +**fields** | [**List[ExportVoucherTransactionsFields]**](ExportVoucherTransactionsFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | [**ExportVoucherTransactionsFilters**](ExportVoucherTransactionsFilters.md) | | [optional] + +[[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/LoyaltiesMembersTransactionsListResponseBody.md b/docs/LoyaltiesMembersTransactionsListResponseBody.md new file mode 100644 index 00000000..50276ce0 --- /dev/null +++ b/docs/LoyaltiesMembersTransactionsListResponseBody.md @@ -0,0 +1,17 @@ +# LoyaltiesMembersTransactionsListResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/members/{memberId}/transactions` and `/loyalties/members/{memberId}/transactions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of transaction objects. | [optional] [default to 'data'] +**data** | [**List[LoyaltyCardTransaction]**](LoyaltyCardTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results. | [optional] +**more_starting_after** | **str** | Returns an ID that can be used to return another page of results. Use the transaction ID in the `starting_after_id` query parameter to display another page of the results starting after the transaction with that ID. | [optional] + +[[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/LoyaltiesMembersTransfersCreateResponseBody.md b/docs/LoyaltiesMembersTransfersCreateResponseBody.md new file mode 100644 index 00000000..f6794036 --- /dev/null +++ b/docs/LoyaltiesMembersTransfersCreateResponseBody.md @@ -0,0 +1,36 @@ +# LoyaltiesMembersTransfersCreateResponseBody + +Response body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transfers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**loyalty_card** | [**LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard**](LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**publish** | [**LoyaltiesMembersTransfersCreateResponseBodyPublish**](LoyaltiesMembersTransfersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**LoyaltiesMembersTransfersCreateResponseBodyRedemption**](LoyaltiesMembersTransfersCreateResponseBodyRedemption.md) | | [optional] +**active** | **str** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date. - `true` indicates an active voucher - `false` indicates an inactive voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**LoyaltiesMembersTransfersCreateResponseBodyAssets**](LoyaltiesMembersTransfersCreateResponseBodyAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**created_at** | **datetime** | | [optional] + +[[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/LoyaltiesMembersTransfersCreateResponseBodyAssets.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyAssets.md new file mode 100644 index 00000000..c7f8c16e --- /dev/null +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyAssets.md @@ -0,0 +1,14 @@ +# LoyaltiesMembersTransfersCreateResponseBodyAssets + +Stores links to images of QR and barcode that correspond to an encrypted voucher code. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**qr** | [**LoyaltiesMembersTransfersCreateResponseBodyAssetsQr**](LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md) | | [optional] +**barcode** | [**LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode**](LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md) | | [optional] + +[[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/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md new file mode 100644 index 00000000..91789bef --- /dev/null +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.md @@ -0,0 +1,14 @@ +# LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode + +Stores barcode representation of encrypted code. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Encrypted voucher code ID. | [optional] +**url** | **str** | URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[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/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md new file mode 100644 index 00000000..037dadf8 --- /dev/null +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.md @@ -0,0 +1,14 @@ +# LoyaltiesMembersTransfersCreateResponseBodyAssetsQr + +Stores Quick Response (QR) representation of encrypted code. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Encrypted voucher code ID. | [optional] +**url** | **str** | URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[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/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..471b5344 --- /dev/null +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **str** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/LoyaltiesMembersTransfersCreateResponseBodyPublish.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md new file mode 100644 index 00000000..26f80bf3 --- /dev/null +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyPublish.md @@ -0,0 +1,16 @@ +# LoyaltiesMembersTransfersCreateResponseBodyPublish + +This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**entries** | **List[str]** | | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications | [optional] + +[[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/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md b/docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md new file mode 100644 index 00000000..22d1f2ed --- /dev/null +++ b/docs/LoyaltiesMembersTransfersCreateResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# LoyaltiesMembersTransfersCreateResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A null value means unlimited. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**object** | **str** | The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateRequestBody.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBody.md new file mode 100644 index 00000000..6b311d85 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBody.md @@ -0,0 +1,13 @@ +# LoyaltiesPointsExpirationExportCreateRequestBody + +Request schema model for validating a voucher using **POST** `/v1/loyalties/{campaignId}/points-expiration/export` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParameters**](LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md new file mode 100644 index 00000000..13aff36a --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParameters.md @@ -0,0 +1,15 @@ +# LoyaltiesPointsExpirationExportCreateRequestBodyParameters + +List of fields and filters that will be used to create the export. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **List[str]** | Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | | [optional] +**filters** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md new file mode 100644 index 00000000..f13dc945 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.md @@ -0,0 +1,15 @@ +# LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters + +Data filters used to narrow down the data records to be returned in the export. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**voucher_id** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md) | | [optional] +**campaign_id** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md new file mode 100644 index 00000000..bcd011c5 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.md @@ -0,0 +1,13 @@ +# LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md new file mode 100644 index 00000000..de3152a0 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.md @@ -0,0 +1,16 @@ +# LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of the resource values that should be included in the results. | [optional] +**not_in** | **List[str]** | Array of the resource values that should be included in the results. | [optional] +**var_is** | **str** | Specify the exact resource value. | [optional] +**is_not** | **str** | Results should omit this value. | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md new file mode 100644 index 00000000..1c91fb2c --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.md @@ -0,0 +1,13 @@ +# LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions**](LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md new file mode 100644 index 00000000..cb218cd4 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.md @@ -0,0 +1,16 @@ +# LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of the resource values that should be included in the results. | [optional] +**not_in** | **List[str]** | Array of the resource values that should be included in the results. | [optional] +**var_is** | **str** | Specify the exact resource value. | [optional] +**is_not** | **str** | Results should omit this value. | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateResponseBody.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBody.md new file mode 100644 index 00000000..d205df0d --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBody.md @@ -0,0 +1,21 @@ +# LoyaltiesPointsExpirationExportCreateResponseBody + +Object representing an export of points expirations. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique export ID. | [optional] +**object** | **str** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**created_at** | **datetime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **str** | Status of the export. Informs you whether the export has already been completed. | [optional] [default to 'SCHEDULED'] +**channel** | **str** | The channel through which the export was triggered. | [optional] +**exported_object** | **str** | The type of exported object. | [optional] [default to 'points_expiration'] +**parameters** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParameters**](LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md) | | [optional] +**result** | **object** | Always null. | [optional] +**user_id** | **str** | `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard. `user_id` is returned when the channel value is `WEBSITE`. | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md new file mode 100644 index 00000000..e19d5601 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParameters.md @@ -0,0 +1,15 @@ +# LoyaltiesPointsExpirationExportCreateResponseBodyParameters + +List of fields and filters that were passed in the request body to create the export. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **List[str]** | Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 | | [optional] +**filters** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md new file mode 100644 index 00000000..da4333f9 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.md @@ -0,0 +1,15 @@ +# LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters + +Data filters used to narrow down the data records to be returned in the export. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**voucher_id** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md) | | [optional] +**campaign_id** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md new file mode 100644 index 00000000..54aea325 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.md @@ -0,0 +1,13 @@ +# LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md new file mode 100644 index 00000000..b91e387b --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.md @@ -0,0 +1,16 @@ +# LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of the resource values that should be included in the results. | [optional] +**not_in** | **List[str]** | Array of the resource values that should be included in the results. | [optional] +**var_is** | **str** | Specify the exact resource value. | [optional] +**is_not** | **str** | Results should omit this value. | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md new file mode 100644 index 00000000..7bd000a3 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.md @@ -0,0 +1,13 @@ +# LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions**](LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md) | | [optional] + +[[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/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md new file mode 100644 index 00000000..bc78fbe5 --- /dev/null +++ b/docs/LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.md @@ -0,0 +1,16 @@ +# LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of the resource values that should be included in the results. | [optional] +**not_in** | **List[str]** | Array of the resource values that should be excluded from the results. | [optional] +**var_is** | **str** | Specify the exact resource value. | [optional] +**is_not** | **str** | Results should omit this value. | [optional] + +[[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/LoyaltiesRewardAssignmentsGetResponseBody.md b/docs/LoyaltiesRewardAssignmentsGetResponseBody.md new file mode 100644 index 00000000..4a2f22c3 --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsGetResponseBody.md @@ -0,0 +1,20 @@ +# LoyaltiesRewardAssignmentsGetResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments/{assignmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**LoyaltiesRewardAssignmentsGetResponseBodyParameters**](LoyaltiesRewardAssignmentsGetResponseBodyParameters.md) | | [optional] + +[[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/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md new file mode 100644 index 00000000..a4507513 --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParameters.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardAssignmentsGetResponseBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty**](LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md) | | [optional] + +[[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/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..224363be --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/LoyaltiesRewardAssignmentsListResponseBody.md b/docs/LoyaltiesRewardAssignmentsListResponseBody.md new file mode 100644 index 00000000..cdc1ee1e --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesRewardAssignmentsListResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of reward assignment objects. | [optional] [default to 'data'] +**data** | [**List[RewardAssignment]**](RewardAssignment.md) | Contains array of reward assignment objects. | [optional] +**total** | **int** | Total number of reward assignment objects. | [optional] + +[[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/LoyaltiesRewardAssignmentsRewardGetResponseBody.md b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md new file mode 100644 index 00000000..e5ef8ff8 --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md @@ -0,0 +1,23 @@ +# LoyaltiesRewardAssignmentsRewardGetResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **str** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes**](LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **str** | Reward type. | [optional] +**parameters** | [**RewardType**](RewardType.md) | | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[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/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md new file mode 100644 index 00000000..0b0115ac --- /dev/null +++ b/docs/LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.md @@ -0,0 +1,14 @@ +# LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes + +These properties are configurable for **material rewards**. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **str** | An arbitrary string that you can attach to a material reward. | [optional] + +[[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/LoyaltiesRewardsCreateAssignmentItemRequestBody.md b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBody.md new file mode 100644 index 00000000..da9f9f96 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBody.md @@ -0,0 +1,14 @@ +# LoyaltiesRewardsCreateAssignmentItemRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reward** | **str** | The ID of the reward that will be assigned to the campaign. | [optional] +**parameters** | [**LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters**](LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md) | | [optional] +**validation_rules** | **List[str]** | | [optional] + +[[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/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md new file mode 100644 index 00000000..de3dd39f --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty**](LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md) | | [optional] + +[[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/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md new file mode 100644 index 00000000..2f551ec8 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. | [optional] + +[[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/LoyaltiesRewardsCreateAssignmentResponseBody.md b/docs/LoyaltiesRewardsCreateAssignmentResponseBody.md new file mode 100644 index 00000000..ee341883 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentResponseBody.md @@ -0,0 +1,20 @@ +# LoyaltiesRewardsCreateAssignmentResponseBody + +Response body schema for **POST** `v1/v1/loyalties/{campaignId}/rewards`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**LoyaltiesRewardsCreateAssignmentResponseBodyParameters**](LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md) | | [optional] + +[[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/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md new file mode 100644 index 00000000..83427b69 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParameters.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsCreateAssignmentResponseBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty**](LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md) | | [optional] + +[[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/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..5bb3d769 --- /dev/null +++ b/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/LoyaltiesRewardsGetResponseBody.md b/docs/LoyaltiesRewardsGetResponseBody.md new file mode 100644 index 00000000..7b97637d --- /dev/null +++ b/docs/LoyaltiesRewardsGetResponseBody.md @@ -0,0 +1,20 @@ +# LoyaltiesRewardsGetResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/rewards/{assignmentId}` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**LoyaltiesRewardsGetResponseBodyParameters**](LoyaltiesRewardsGetResponseBodyParameters.md) | | [optional] + +[[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/LoyaltiesRewardsGetResponseBodyParameters.md b/docs/LoyaltiesRewardsGetResponseBodyParameters.md new file mode 100644 index 00000000..59985600 --- /dev/null +++ b/docs/LoyaltiesRewardsGetResponseBodyParameters.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsGetResponseBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**LoyaltiesRewardsGetResponseBodyParametersLoyalty**](LoyaltiesRewardsGetResponseBodyParametersLoyalty.md) | | [optional] + +[[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/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..ce093a55 --- /dev/null +++ b/docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsGetResponseBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/LoyaltiesRewardsListAssignmentsResponseBody.md b/docs/LoyaltiesRewardsListAssignmentsResponseBody.md new file mode 100644 index 00000000..bf568e77 --- /dev/null +++ b/docs/LoyaltiesRewardsListAssignmentsResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesRewardsListAssignmentsResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/rewards`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of reward assignment objects. | [optional] [default to 'data'] +**data** | [**List[RewardAssignment]**](RewardAssignment.md) | Contains array of reward assignment objects. | [optional] +**total** | **int** | Total number of reward assignment objects. | [optional] + +[[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/LoyaltiesRewardsUpdateAssignmentRequestBody.md b/docs/LoyaltiesRewardsUpdateAssignmentRequestBody.md new file mode 100644 index 00000000..3ba55b52 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentRequestBody.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsUpdateAssignmentRequestBody + +Response body schema for **PUT** `v1/v1/loyalties/{campaignId}/rewards/{assignmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**LoyaltiesRewardsUpdateAssignmentRequestBodyParameters**](LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md) | | [optional] + +[[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/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md new file mode 100644 index 00000000..b50836c7 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsUpdateAssignmentRequestBodyParameters + +An object that defines the price of the reward in loyalty points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty**](LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md) | | [optional] + +[[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/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md new file mode 100644 index 00000000..75983274 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty + +Stores the points parameter. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Defines how many points are required to obtain the reward. | [optional] + +[[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/LoyaltiesRewardsUpdateAssignmentResponseBody.md b/docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md new file mode 100644 index 00000000..4cc69719 --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md @@ -0,0 +1,20 @@ +# LoyaltiesRewardsUpdateAssignmentResponseBody + +Response body schema for **PUT** `v1/v1/loyalties/{campaignId}/rewards/{assignmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**LoyaltiesRewardsUpdateAssignmentResponseBodyParameters**](LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md) | | [optional] + +[[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/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md new file mode 100644 index 00000000..9f110a7c --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsUpdateAssignmentResponseBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty**](LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md) | | [optional] + +[[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/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..64d1049a --- /dev/null +++ b/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/LoyaltiesTiersCreateInBulkRequestBodyItem.md b/docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md new file mode 100644 index 00000000..189ee0d8 --- /dev/null +++ b/docs/LoyaltiesTiersCreateInBulkRequestBodyItem.md @@ -0,0 +1,16 @@ +# LoyaltiesTiersCreateInBulkRequestBodyItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Loyalty Tier name. | [optional] +**earning_rules** | **object** | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | **object** | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] + +[[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/LoyaltiesTiersEarningRulesListResponseBody.md b/docs/LoyaltiesTiersEarningRulesListResponseBody.md new file mode 100644 index 00000000..e34b3543 --- /dev/null +++ b/docs/LoyaltiesTiersEarningRulesListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesTiersEarningRulesListResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about earning rules in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of earning rule objects. | [optional] [default to 'data'] +**data** | [**List[EarningRule]**](EarningRule.md) | Contains array of earning rule objects. | [optional] +**total** | **int** | Total number of earning rule objects. | [optional] + +[[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/LoyaltiesTiersGetResponseBody.md b/docs/LoyaltiesTiersGetResponseBody.md new file mode 100644 index 00000000..6029c62f --- /dev/null +++ b/docs/LoyaltiesTiersGetResponseBody.md @@ -0,0 +1,24 @@ +# LoyaltiesTiersGetResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Loyalty Tier name. | [optional] +**earning_rules** | **object** | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | **object** | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**LoyaltiesTiersGetResponseBodyPoints**](LoyaltiesTiersGetResponseBodyPoints.md) | | [optional] +**id** | **str** | Unique loyalty tier ID. | [optional] +**campaign_id** | **str** | Unique parent campaign ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] +**config** | [**LoyaltiesTiersGetResponseBodyConfig**](LoyaltiesTiersGetResponseBodyConfig.md) | | [optional] +**expiration** | [**LoyaltyTierExpiration**](LoyaltyTierExpiration.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the loyalty. | [optional] [default to 'loyalty_tier'] + +[[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/LoyaltiesTiersGetResponseBodyConfig.md b/docs/LoyaltiesTiersGetResponseBodyConfig.md new file mode 100644 index 00000000..55621011 --- /dev/null +++ b/docs/LoyaltiesTiersGetResponseBodyConfig.md @@ -0,0 +1,13 @@ +# LoyaltiesTiersGetResponseBodyConfig + +Defines loyalty tier range in points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | [**LoyaltiesTiersGetResponseBodyConfigPoints**](LoyaltiesTiersGetResponseBodyConfigPoints.md) | | [optional] + +[[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/LoyaltiesTiersGetResponseBodyConfigPoints.md b/docs/LoyaltiesTiersGetResponseBodyConfigPoints.md new file mode 100644 index 00000000..8e17ecbd --- /dev/null +++ b/docs/LoyaltiesTiersGetResponseBodyConfigPoints.md @@ -0,0 +1,14 @@ +# LoyaltiesTiersGetResponseBodyConfigPoints + +Defines range of loyalty tier in points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [optional] + +[[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/LoyaltiesTiersGetResponseBodyPoints.md b/docs/LoyaltiesTiersGetResponseBodyPoints.md new file mode 100644 index 00000000..ff0c42c3 --- /dev/null +++ b/docs/LoyaltiesTiersGetResponseBodyPoints.md @@ -0,0 +1,14 @@ +# LoyaltiesTiersGetResponseBodyPoints + +Defines range of loyalty tier in points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [optional] + +[[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/LoyaltiesTiersListResponseBody.md b/docs/LoyaltiesTiersListResponseBody.md new file mode 100644 index 00000000..fcb3fab3 --- /dev/null +++ b/docs/LoyaltiesTiersListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesTiersListResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/tiers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of loyalty tier objects. | [optional] [default to 'data'] +**data** | [**List[LoyaltyTier]**](LoyaltyTier.md) | This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer's tiers. | [optional] +**total** | **int** | Total number of loyalty tier objects. | [optional] + +[[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/LoyaltiesTiersRewardsListResponseBody.md b/docs/LoyaltiesTiersRewardsListResponseBody.md new file mode 100644 index 00000000..0132b2d9 --- /dev/null +++ b/docs/LoyaltiesTiersRewardsListResponseBody.md @@ -0,0 +1,16 @@ +# LoyaltiesTiersRewardsListResponseBody + +Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about loyalty tier rewards in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of loyalty tier reward objects. | [optional] [default to 'data'] +**data** | [**List[LoyaltiesLoyaltyTierReward]**](LoyaltiesLoyaltyTierReward.md) | Contains array of loyalty tier reward objects. | [optional] +**total** | **int** | Total number of loyalty tier reward objects. | [optional] + +[[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/LoyaltiesTransferPoints.md b/docs/LoyaltiesTransferPoints.md new file mode 100644 index 00000000..cab64153 --- /dev/null +++ b/docs/LoyaltiesTransferPoints.md @@ -0,0 +1,15 @@ +# LoyaltiesTransferPoints + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Unique loyalty card code from which the user wants to transfer loyalty points (source). | [optional] +**points** | **int** | The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source). | [optional] +**reason** | **str** | Reason for the transfer. | [optional] +**source_id** | **str** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] + +[[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/LoyaltiesUpdateCampaignRequestBody.md b/docs/LoyaltiesUpdateCampaignRequestBody.md new file mode 100644 index 00000000..59c4e95f --- /dev/null +++ b/docs/LoyaltiesUpdateCampaignRequestBody.md @@ -0,0 +1,28 @@ +# LoyaltiesUpdateCampaignRequestBody + +Request body schema for **PUT** `/loyalties/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**category** | **str** | The category assigned to the campaign. Either pass this parameter OR the `category_id`. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**unset_metadata_fields** | **List[str]** | Determine which metadata should be removed from campaign. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`. | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published. | [optional] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**options** | [**LoyaltiesUpdateCampaignRequestBodyOptions**](LoyaltiesUpdateCampaignRequestBodyOptions.md) | | [optional] + +[[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/LoyaltiesUpdateCampaignRequestBodyOptions.md b/docs/LoyaltiesUpdateCampaignRequestBodyOptions.md new file mode 100644 index 00000000..ec4dd56a --- /dev/null +++ b/docs/LoyaltiesUpdateCampaignRequestBodyOptions.md @@ -0,0 +1,12 @@ +# LoyaltiesUpdateCampaignRequestBodyOptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**recalculate_tiers** | **bool** | Determine if tiers should be recalculated or no. | [optional] + +[[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/LoyaltiesUpdateCampaignResponseBody.md b/docs/LoyaltiesUpdateCampaignResponseBody.md new file mode 100644 index 00000000..faa913a7 --- /dev/null +++ b/docs/LoyaltiesUpdateCampaignResponseBody.md @@ -0,0 +1,42 @@ +# LoyaltiesUpdateCampaignResponseBody + +Response body schema for **PUT** `/loyalties/{campaignId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] + +[[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/LoyaltyCampaign.md b/docs/LoyaltyCampaign.md new file mode 100644 index 00000000..6bb2f3eb --- /dev/null +++ b/docs/LoyaltyCampaign.md @@ -0,0 +1,41 @@ +# LoyaltyCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**name** | **str** | Campaign name. | [optional] +**description** | **str** | An optional field to keep any extra textual information about the campaign such as a campaign description and details. | [optional] +**campaign_type** | **str** | Type of campaign. | [optional] [default to 'LOYALTY_PROGRAM'] +**type** | **str** | Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published | [optional] +**voucher** | [**LoyaltyCampaignVoucher**](LoyaltyCampaignVoucher.md) | | [optional] +**auto_join** | **bool** | Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. | [optional] +**join_once** | **bool** | If this value is set to `true`, customers will be able to join the campaign only once. | [optional] +**use_voucher_metadata_schema** | **bool** | Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**activity_duration_after_publishing** | **str** | Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days. | [optional] +**vouchers_count** | **int** | Total number of unique vouchers in campaign. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**active** | **bool** | A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the campaign was last updated in ISO 8601 format. | [optional] +**category** | **str** | Unique category name. | [optional] +**creation_status** | **str** | Indicates the status of the campaign creation. | [optional] +**vouchers_generation_status** | **str** | Indicates the status of the campaign's voucher generation. | [optional] +**protected** | **bool** | Indicates whether the resource can be deleted. | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the campaign. | [optional] [default to 'campaign'] +**loyalty_tiers_expiration** | [**LoyaltyTiersExpirationAll**](LoyaltyTiersExpirationAll.md) | | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**access_settings_assignments** | [**AccessSettingsCampaignAssignmentsList**](AccessSettingsCampaignAssignmentsList.md) | | [optional] + +[[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/LoyaltyCampaignVoucher.md b/docs/LoyaltyCampaignVoucher.md new file mode 100644 index 00000000..d305d0a7 --- /dev/null +++ b/docs/LoyaltyCampaignVoucher.md @@ -0,0 +1,22 @@ +# LoyaltyCampaignVoucher + +Schema model for a campaign voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Type of voucher. | [optional] [default to 'LOYALTY_CARD'] +**loyalty_card** | [**CampaignLoyaltyCard**](CampaignLoyaltyCard.md) | | [optional] +**redemption** | [**LoyaltyCampaignVoucherRedemption**](LoyaltyCampaignVoucherRedemption.md) | | [optional] +**code_config** | [**CodeConfig**](CodeConfig.md) | | +**is_referral_code** | **bool** | Always `false` for a loyalty card voucher | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] + +[[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/LoyaltyCampaignVoucherRedemption.md b/docs/LoyaltyCampaignVoucherRedemption.md new file mode 100644 index 00000000..4e918d92 --- /dev/null +++ b/docs/LoyaltyCampaignVoucherRedemption.md @@ -0,0 +1,13 @@ +# LoyaltyCampaignVoucherRedemption + +Defines the redemption limits on vouchers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/LoyaltyCardTransaction.md b/docs/LoyaltyCardTransaction.md new file mode 100644 index 00000000..f89a83f1 --- /dev/null +++ b/docs/LoyaltyCardTransaction.md @@ -0,0 +1,21 @@ +# LoyaltyCardTransaction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique transaction ID. | [optional] +**source_id** | **str** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | [optional] +**voucher_id** | **str** | Unique voucher ID. | [optional] +**campaign_id** | **str** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | [optional] +**source** | **str** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | [optional] +**reason** | **str** | Reason why the transaction occurred. In case of a redemption, this value is null. | [optional] +**type** | [**LoyaltyCardTransactionsType**](LoyaltyCardTransactionsType.md) | | +**details** | [**LoyaltyCardTransactionDetails**](LoyaltyCardTransactionDetails.md) | | [optional] +**related_transaction_id** | **str** | The related transaction ID on the receiving card. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/LoyaltyCardTransactionDetails.md b/docs/LoyaltyCardTransactionDetails.md new file mode 100644 index 00000000..af472eee --- /dev/null +++ b/docs/LoyaltyCardTransactionDetails.md @@ -0,0 +1,25 @@ +# LoyaltyCardTransactionDetails + +Contains the detailed information about the transaction. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | [**LoyaltyCardTransactionDetailsBalance**](LoyaltyCardTransactionDetailsBalance.md) | | [optional] +**order** | [**LoyaltyCardTransactionDetailsOrder**](LoyaltyCardTransactionDetailsOrder.md) | | [optional] +**event** | [**LoyaltyCardTransactionDetailsEvent**](LoyaltyCardTransactionDetailsEvent.md) | | [optional] +**earning_rule** | [**LoyaltyCardTransactionDetailsEarningRule**](LoyaltyCardTransactionDetailsEarningRule.md) | | [optional] +**segment** | [**LoyaltyCardTransactionDetailsSegment**](LoyaltyCardTransactionDetailsSegment.md) | | [optional] +**loyalty_tier** | [**LoyaltyCardTransactionDetailsLoyaltyTier**](LoyaltyCardTransactionDetailsLoyaltyTier.md) | | [optional] +**redemption** | [**LoyaltyCardTransactionDetailsRedemption**](LoyaltyCardTransactionDetailsRedemption.md) | | [optional] +**rollback** | [**LoyaltyCardTransactionDetailsRollback**](LoyaltyCardTransactionDetailsRollback.md) | | [optional] +**custom_event** | [**LoyaltyCardTransactionDetailsCustomEvent**](LoyaltyCardTransactionDetailsCustomEvent.md) | | [optional] +**event_schema** | [**LoyaltyCardTransactionDetailsEventSchema**](LoyaltyCardTransactionDetailsEventSchema.md) | | [optional] +**reward** | [**LoyaltyCardTransactionDetailsReward**](LoyaltyCardTransactionDetailsReward.md) | | [optional] +**source_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] +**destination_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] + +[[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/LoyaltyCardTransactionDetailsBalance.md b/docs/LoyaltyCardTransactionDetailsBalance.md new file mode 100644 index 00000000..68703140 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsBalance.md @@ -0,0 +1,18 @@ +# LoyaltyCardTransactionDetailsBalance + +Contains information on how the balance was affected by the transaction. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The type of voucher whose balance is being adjusted due to the transaction. | [optional] [default to 'loyalty_card'] +**total** | **int** | The number of all points accumulated on the card as affected by add or subtract operations. | [optional] +**object** | **str** | The type of the object represented by the JSON. | [optional] [default to 'balance'] +**points** | **int** | Points added or subtracted in the transaction. | [optional] +**balance** | **int** | The available points on the card after the transaction as affected by redemption or rollback. | [optional] +**related_object** | [**LoyaltyCardTransactionDetailsBalanceRelatedObject**](LoyaltyCardTransactionDetailsBalanceRelatedObject.md) | | [optional] + +[[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/LoyaltyCardTransactionDetailsBalanceRelatedObject.md b/docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md new file mode 100644 index 00000000..130ef09c --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsBalanceRelatedObject.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsBalanceRelatedObject + +Defines the resource that is being modified with the values that are returned in the balance object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] +**type** | **str** | The object being modified, i.e. voucher. | [optional] [default to 'voucher'] + +[[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/LoyaltyCardTransactionDetailsCustomEvent.md b/docs/LoyaltyCardTransactionDetailsCustomEvent.md new file mode 100644 index 00000000..9d0b0e5f --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsCustomEvent.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsCustomEvent + +Contains information about the custom event that triggers the point accrual. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique event ID. | [optional] +**type** | **str** | Type of custom event. | [optional] + +[[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/LoyaltyCardTransactionDetailsEarningRule.md b/docs/LoyaltyCardTransactionDetailsEarningRule.md new file mode 100644 index 00000000..600cb2bd --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEarningRule.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsEarningRule + +Contains information about the earning rule. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique earning rule ID. | [optional] +**source** | [**LoyaltyCardTransactionDetailsEarningRuleSource**](LoyaltyCardTransactionDetailsEarningRuleSource.md) | | [optional] + +[[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/LoyaltyCardTransactionDetailsEarningRuleSource.md b/docs/LoyaltyCardTransactionDetailsEarningRuleSource.md new file mode 100644 index 00000000..8745c1fa --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEarningRuleSource.md @@ -0,0 +1,13 @@ +# LoyaltyCardTransactionDetailsEarningRuleSource + +Contains the custom earning rule name. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[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/LoyaltyCardTransactionDetailsEvent.md b/docs/LoyaltyCardTransactionDetailsEvent.md new file mode 100644 index 00000000..50cc8149 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEvent.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsEvent + +Contains information about the event that triggers the point accrual. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique event ID. | [optional] +**type** | **str** | Type of event. | [optional] + +[[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/LoyaltyCardTransactionDetailsEventSchema.md b/docs/LoyaltyCardTransactionDetailsEventSchema.md new file mode 100644 index 00000000..b7672f7d --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsEventSchema.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsEventSchema + +Contains information about the custom event metadata schema. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique metadata schema ID. | [optional] +**name** | **str** | Type of custom event. | [optional] + +[[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/LoyaltyCardTransactionDetailsLoyaltyTier.md b/docs/LoyaltyCardTransactionDetailsLoyaltyTier.md new file mode 100644 index 00000000..bcf456d6 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsLoyaltyTier.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsLoyaltyTier + +Contains information about the loyalty tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**name** | **str** | | [optional] + +[[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/LoyaltyCardTransactionDetailsOrder.md b/docs/LoyaltyCardTransactionDetailsOrder.md new file mode 100644 index 00000000..696d3629 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsOrder.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsOrder + +Contains information about the original order. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique order ID. | [optional] +**source_id** | **str** | The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | [optional] + +[[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/LoyaltyCardTransactionDetailsRedemption.md b/docs/LoyaltyCardTransactionDetailsRedemption.md new file mode 100644 index 00000000..a160fe43 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsRedemption.md @@ -0,0 +1,13 @@ +# LoyaltyCardTransactionDetailsRedemption + +Contains information about the original redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] + +[[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/LoyaltyCardTransactionDetailsReward.md b/docs/LoyaltyCardTransactionDetailsReward.md new file mode 100644 index 00000000..98b69f86 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsReward.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsReward + +Contains information about the pay with points reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID. | [optional] +**name** | **str** | Reward name. | [optional] + +[[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/LoyaltyCardTransactionDetailsRollback.md b/docs/LoyaltyCardTransactionDetailsRollback.md new file mode 100644 index 00000000..69284a6a --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsRollback.md @@ -0,0 +1,13 @@ +# LoyaltyCardTransactionDetailsRollback + +Contains information about the redemption rollback. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption rollback ID. | [optional] + +[[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/LoyaltyCardTransactionDetailsSegment.md b/docs/LoyaltyCardTransactionDetailsSegment.md new file mode 100644 index 00000000..6a01c306 --- /dev/null +++ b/docs/LoyaltyCardTransactionDetailsSegment.md @@ -0,0 +1,14 @@ +# LoyaltyCardTransactionDetailsSegment + +Contains information about the segment. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**name** | **str** | | [optional] + +[[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/LoyaltyCardTransactionsType.md b/docs/LoyaltyCardTransactionsType.md new file mode 100644 index 00000000..36538276 --- /dev/null +++ b/docs/LoyaltyCardTransactionsType.md @@ -0,0 +1,24 @@ +# LoyaltyCardTransactionsType + + +## Enum + +* `POINTS_ACCRUAL` (value: `'POINTS_ACCRUAL'`) + +* `POINTS_REDEMPTION` (value: `'POINTS_REDEMPTION'`) + +* `POINTS_REFUND` (value: `'POINTS_REFUND'`) + +* `POINTS_ADDITION` (value: `'POINTS_ADDITION'`) + +* `POINTS_REMOVAL` (value: `'POINTS_REMOVAL'`) + +* `POINTS_EXPIRATION` (value: `'POINTS_EXPIRATION'`) + +* `POINTS_TRANSFER_IN` (value: `'POINTS_TRANSFER_IN'`) + +* `POINTS_TRANSFER_OUT` (value: `'POINTS_TRANSFER_OUT'`) + +[[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/LoyaltyMember.md b/docs/LoyaltyMember.md new file mode 100644 index 00000000..9114c6bb --- /dev/null +++ b/docs/LoyaltyMember.md @@ -0,0 +1,38 @@ +# LoyaltyMember + +This is an object representing a loyalty member. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] [default to 'LOYALTY_CARD'] +**discount** | **object** | | [optional] +**gift** | **object** | | [optional] +**loyalty_card** | [**LoyaltyMemberLoyaltyCard**](LoyaltyMemberLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | This is always false for loyalty members. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique identifier of the customer who owns the voucher. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**LoyaltyMemberPublish**](LoyaltyMemberPublish.md) | | [optional] +**redemption** | [**LoyaltyMemberRedemption**](LoyaltyMemberRedemption.md) | | [optional] + +[[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/LoyaltyMemberLoyaltyCard.md b/docs/LoyaltyMemberLoyaltyCard.md new file mode 100644 index 00000000..76808fe9 --- /dev/null +++ b/docs/LoyaltyMemberLoyaltyCard.md @@ -0,0 +1,16 @@ +# LoyaltyMemberLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/LoyaltyMemberPublish.md b/docs/LoyaltyMemberPublish.md new file mode 100644 index 00000000..e8ff86fc --- /dev/null +++ b/docs/LoyaltyMemberPublish.md @@ -0,0 +1,15 @@ +# LoyaltyMemberPublish + +This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication event counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/LoyaltyMemberRedemption.md b/docs/LoyaltyMemberRedemption.md new file mode 100644 index 00000000..e8b46e83 --- /dev/null +++ b/docs/LoyaltyMemberRedemption.md @@ -0,0 +1,17 @@ +# LoyaltyMemberRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/LoyaltyTier.md b/docs/LoyaltyTier.md new file mode 100644 index 00000000..1bbccf55 --- /dev/null +++ b/docs/LoyaltyTier.md @@ -0,0 +1,23 @@ +# LoyaltyTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Loyalty Tier name. | [optional] +**earning_rules** | **object** | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | **object** | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**LoyaltyTierPoints**](LoyaltyTierPoints.md) | | [optional] +**id** | **str** | Unique loyalty tier ID. | [optional] +**campaign_id** | **str** | Unique parent campaign ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] +**config** | [**LoyaltyTierConfig**](LoyaltyTierConfig.md) | | [optional] +**expiration** | [**LoyaltyTierExpiration**](LoyaltyTierExpiration.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the loyalty. | [optional] [default to 'loyalty_tier'] + +[[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/LoyaltyTierBase.md b/docs/LoyaltyTierBase.md new file mode 100644 index 00000000..a5d8517c --- /dev/null +++ b/docs/LoyaltyTierBase.md @@ -0,0 +1,15 @@ +# LoyaltyTierBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Loyalty Tier name. | [optional] +**earning_rules** | **object** | Contains a list of earning rule IDs and their points mapping for the given earning rule. | [optional] +**rewards** | **object** | Contains a list of reward IDs and their points mapping for the given reward. | [optional] +**points** | [**LoyaltyTierBasePoints**](LoyaltyTierBasePoints.md) | | [optional] + +[[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/LoyaltyTierBasePoints.md b/docs/LoyaltyTierBasePoints.md new file mode 100644 index 00000000..8bba4120 --- /dev/null +++ b/docs/LoyaltyTierBasePoints.md @@ -0,0 +1,14 @@ +# LoyaltyTierBasePoints + +Defines range of loyalty tier in points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [optional] + +[[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/LoyaltyTierConfig.md b/docs/LoyaltyTierConfig.md new file mode 100644 index 00000000..d7f12448 --- /dev/null +++ b/docs/LoyaltyTierConfig.md @@ -0,0 +1,13 @@ +# LoyaltyTierConfig + +Defines loyalty tier range in points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | [**LoyaltyTierConfigPoints**](LoyaltyTierConfigPoints.md) | | [optional] + +[[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/LoyaltyTierConfigPoints.md b/docs/LoyaltyTierConfigPoints.md new file mode 100644 index 00000000..9e78b4cf --- /dev/null +++ b/docs/LoyaltyTierConfigPoints.md @@ -0,0 +1,14 @@ +# LoyaltyTierConfigPoints + +Defines range of loyalty tier in points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [optional] + +[[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/LoyaltyTierExpiration.md b/docs/LoyaltyTierExpiration.md new file mode 100644 index 00000000..8b0c686c --- /dev/null +++ b/docs/LoyaltyTierExpiration.md @@ -0,0 +1,19 @@ +# LoyaltyTierExpiration + +Defines loyalty tier expiration date. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**campaign_id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**tier_id** | **str** | Unique tier ID, assigned by Voucherify. | [optional] +**start_date** | **str** | Activation timestamp defines when the loyalty tier starts to be active in ISO 8601 format. Loyalty tier is inactive before this date. | [optional] +**expiration_date** | **str** | Expiration timestamp defines when the loyalty tier expires in ISO 8601 format. Loyalty tier is inactive after this date. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format. | [optional] + +[[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/LoyaltyTierPoints.md b/docs/LoyaltyTierPoints.md new file mode 100644 index 00000000..f747b355 --- /dev/null +++ b/docs/LoyaltyTierPoints.md @@ -0,0 +1,14 @@ +# LoyaltyTierPoints + +Defines range of loyalty tier in points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_from** | **int** | Bottom points threshold value. | [optional] +**to** | **int** | Top points threshold value. | [optional] + +[[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/LoyaltyTiersExpirationAll.md b/docs/LoyaltyTiersExpirationAll.md new file mode 100644 index 00000000..89bfe661 --- /dev/null +++ b/docs/LoyaltyTiersExpirationAll.md @@ -0,0 +1,16 @@ +# LoyaltyTiersExpirationAll + +Defines the Loyalty Tiers Expiration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**qualification_type** | **str** | Tier qualification. `BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold. | [optional] +**qualification_period** | **str** | Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. | **Period** | **Definition** | |:---|:---| | **Calendar Month** | Points collected in one calendar month<br>January, February, March, etc. | | **Calendar Quarter** | Points collected in the quarter<br>- January - March<br>- April - June<br>- July - September<br>- October - December | | **Calendar Half-year** | Points collected in the half-year<br>- January - June<br>- July - December | | **Calendar Year** | Points collected in one calendar year<br>January - December | | [optional] +**start_date** | [**LoyaltyTiersExpirationAllStartDate**](LoyaltyTiersExpirationAllStartDate.md) | | [optional] +**expiration_date** | [**LoyaltyTiersExpirationAllExpirationDate**](LoyaltyTiersExpirationAllExpirationDate.md) | | [optional] + +[[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/LoyaltyTiersExpirationAllExpirationDate.md b/docs/LoyaltyTiersExpirationAllExpirationDate.md new file mode 100644 index 00000000..22802e5c --- /dev/null +++ b/docs/LoyaltyTiersExpirationAllExpirationDate.md @@ -0,0 +1,15 @@ +# LoyaltyTiersExpirationAllExpirationDate + +Defines the conditions for the expiration date of a tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | What triggers the tier to expire for a customer. `END_OF_PERIOD`: Expire tier at the end of the period. `END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier. | [optional] +**extend** | **str** | Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day. | [optional] +**rounding** | [**LoyaltyTiersExpirationAllExpirationDateRounding**](LoyaltyTiersExpirationAllExpirationDateRounding.md) | | [optional] + +[[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/LoyaltyTiersExpirationAllExpirationDateRounding.md b/docs/LoyaltyTiersExpirationAllExpirationDateRounding.md new file mode 100644 index 00000000..9fd3f211 --- /dev/null +++ b/docs/LoyaltyTiersExpirationAllExpirationDateRounding.md @@ -0,0 +1,16 @@ +# LoyaltyTiersExpirationAllExpirationDateRounding + +Defines the rounding mechanism for tier expiration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | This mechanism describes a custom rounding for the expiration date. | [optional] +**strategy** | **str** | This mechanism describes a rounding strategy for the expiration date. | [optional] +**unit** | **str** | Defines the type of unit of time in which the rounding period is counted. | [optional] [default to 'MONTH'] +**value** | **int** | Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. - `0`: January - `1`: February - `2`: March - `3`: April - `4`: May - `5`: June - `6`: July - `7`: August - `8`: September - `9`: October - `10`: November - `11`: December | [optional] + +[[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/LoyaltyTiersExpirationAllStartDate.md b/docs/LoyaltyTiersExpirationAllStartDate.md new file mode 100644 index 00000000..6b3a9821 --- /dev/null +++ b/docs/LoyaltyTiersExpirationAllStartDate.md @@ -0,0 +1,13 @@ +# LoyaltyTiersExpirationAllStartDate + +Defines the conditions for the start date of the tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | What triggers the tier to be valid for a customer. `IMMEDIATE`: After reaching the minimum required points. `NEXT_PERIOD`: When the next qualification period starts. | [optional] + +[[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/LuckyDraw.md b/docs/LuckyDraw.md new file mode 100644 index 00000000..32f11b4f --- /dev/null +++ b/docs/LuckyDraw.md @@ -0,0 +1,15 @@ +# LuckyDraw + +Object for defining detailed information about lucky draw should be applied + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**winners_count** | **str** | It represents the total number of winners in a lucky draw. | [optional] +**unique_winners_per_draw** | **str** | It indicates whether each winner in a draw is unique or not. | [optional] +**unique_winners** | **str** | Specifies whether each participant can win only once across multiple draws. | [optional] + +[[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/MemberActivity.md b/docs/MemberActivity.md new file mode 100644 index 00000000..72f8e5c5 --- /dev/null +++ b/docs/MemberActivity.md @@ -0,0 +1,17 @@ +# MemberActivity + +This is an object representing member activity. This is a general object which presents moments from members' activity. There are all types of different events that members perform during their journey once they participate in a loyalty program. Events describe moments when the members redeem loyalty cards and earn points or rewards. The list of all types of activities is listed below. The details describing the activity are collected in an array property named `data`. In this object, software integrators can find all further information explaining the event context. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique event ID, assigned by Voucherify. | [optional] +**type** | **str** | Event type. | [optional] +**data** | **object** | Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the member activity occurred in ISO 8601 format. | [optional] +**group_id** | **str** | Unique identifier of the request that caused the event. | [optional] + +[[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/Order.md b/docs/Order.md new file mode 100644 index 00000000..bd37ca6f --- /dev/null +++ b/docs/Order.md @@ -0,0 +1,20 @@ +# Order + +Order information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**List[OrderItem]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] + +[[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/OrderCalculated.md b/docs/OrderCalculated.md new file mode 100644 index 00000000..d00f1635 --- /dev/null +++ b/docs/OrderCalculated.md @@ -0,0 +1,34 @@ +# OrderCalculated + +Order information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**List[OrderCalculatedItem]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | **object** | | [optional] + +[[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/OrderCalculatedItem.md b/docs/OrderCalculatedItem.md new file mode 100644 index 00000000..969aedfa --- /dev/null +++ b/docs/OrderCalculatedItem.md @@ -0,0 +1,32 @@ +# OrderCalculatedItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the order line item. | [optional] +**sku_id** | **str** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] +**product_id** | **str** | Unique identifier of the product. It is assigned by Voucherify. | [optional] +**related_object** | **str** | Used along with the source_id property, can be set to either sku or product. | [optional] +**source_id** | **str** | The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] +**quantity** | **int** | The quantity of the particular item in the cart. | [optional] +**discount_quantity** | **int** | Number of dicounted items. | [optional] +**initial_quantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] +**amount** | **int** | The total amount of the order item (price * quantity). | [optional] +**discount_amount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**applied_discount_quantity** | **int** | Number of the discounted items applied in the transaction. | [optional] +**applied_quantity** | **int** | Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] +**applied_quantity_amount** | **int** | Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**subtotal_amount** | **int** | Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount` | [optional] +**product** | [**OrderCalculatedItemProduct**](OrderCalculatedItemProduct.md) | | [optional] +**sku** | [**OrderCalculatedItemSku**](OrderCalculatedItemSku.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order_item'] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format. | [optional] + +[[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/OrderCalculatedItemProduct.md b/docs/OrderCalculatedItemProduct.md new file mode 100644 index 00000000..397c0160 --- /dev/null +++ b/docs/OrderCalculatedItemProduct.md @@ -0,0 +1,18 @@ +# OrderCalculatedItemProduct + +An object containing details of the related product. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] +**source_id** | **str** | The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**name** | **str** | Product name. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. | [optional] +**price** | **float** | Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/OrderCalculatedItemSku.md b/docs/OrderCalculatedItemSku.md new file mode 100644 index 00000000..3a403a35 --- /dev/null +++ b/docs/OrderCalculatedItemSku.md @@ -0,0 +1,17 @@ +# OrderCalculatedItemSku + +An object containing details of the related SKU. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**source_id** | **str** | The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**sku** | **str** | The SKU name. | [optional] +**price** | **float** | SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/OrderItem.md b/docs/OrderItem.md new file mode 100644 index 00000000..3c1980d5 --- /dev/null +++ b/docs/OrderItem.md @@ -0,0 +1,25 @@ +# OrderItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sku_id** | **str** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] +**product_id** | **str** | Unique identifier of the product. It is assigned by Voucherify. | [optional] +**related_object** | **str** | Used along with the source_id property, can be set to either sku or product. | [optional] +**source_id** | **str** | The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service. | [optional] +**quantity** | **int** | The quantity of the particular item in the cart. | [optional] +**discount_quantity** | **int** | Number of dicounted items. | [optional] +**initial_quantity** | **int** | A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity. | [optional] +**amount** | **int** | The total amount of the order item (price * quantity). | [optional] +**discount_amount** | **int** | Sum of all order-item-level discounts applied to the order. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**price** | **int** | Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**product** | [**OrderItemProduct**](OrderItemProduct.md) | | [optional] +**sku** | [**OrderItemSku**](OrderItemSku.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format. | [optional] + +[[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/OrderItemProduct.md b/docs/OrderItemProduct.md new file mode 100644 index 00000000..0e9df6e7 --- /dev/null +++ b/docs/OrderItemProduct.md @@ -0,0 +1,18 @@ +# OrderItemProduct + +An object containing details of the related product. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] +**source_id** | **str** | The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**name** | **str** | Product name. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format. | [optional] +**price** | **float** | Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/OrderItemSku.md b/docs/OrderItemSku.md new file mode 100644 index 00000000..fdc4b4cd --- /dev/null +++ b/docs/OrderItemSku.md @@ -0,0 +1,17 @@ +# OrderItemSku + +An object containing details of the related SKU. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**source_id** | **str** | The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service. | [optional] +**override** | **bool** | The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system. | [optional] +**sku** | **str** | The SKU name. | [optional] +**price** | **float** | SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/OrdersApi.md b/docs/OrdersApi.md new file mode 100644 index 00000000..e2194c79 --- /dev/null +++ b/docs/OrdersApi.md @@ -0,0 +1,541 @@ +# voucherify.OrdersApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_order**](OrdersApi.md#create_order) | **POST** /v1/orders | Create Order +[**create_order_export**](OrdersApi.md#create_order_export) | **POST** /v1/orders/export | Create Orders Export +[**get_order**](OrdersApi.md#get_order) | **GET** /v1/orders/{orderId} | Get Order +[**import_orders**](OrdersApi.md#import_orders) | **POST** /v1/orders/import | Import Orders +[**list_orders**](OrdersApi.md#list_orders) | **GET** /v1/orders | List Orders +[**update_order**](OrdersApi.md#update_order) | **PUT** /v1/orders/{orderId} | Update Order + + +# **create_order** +> OrdersCreateResponseBody create_order(orders_create_request_body=orders_create_request_body) + +Create Order + +Creates an order object and triggers an order creation event. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the order database, Voucherify will return a related order object with updated fields. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.orders_create_request_body import OrdersCreateRequestBody +from voucherify.models.orders_create_response_body import OrdersCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.OrdersApi(api_client) + orders_create_request_body = {"amount":20000,"customer":{"source_id":"sample_customer"},"status":"PAID","items":[{"quantity":1,"price":20000,"source_id":"sample product1","related_object":"product","product":{"metadata":{"key":"value"}}}]} # OrdersCreateRequestBody | Specify the order parameters. (optional) + + try: + # Create Order + api_response = api_instance.create_order(orders_create_request_body=orders_create_request_body) + print("The response of OrdersApi->create_order:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrdersApi->create_order: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orders_create_request_body** | [**OrdersCreateRequestBody**](OrdersCreateRequestBody.md)| Specify the order parameters. | [optional] + +### Return type + +[**OrdersCreateResponseBody**](OrdersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an order object if the operation succeeded. | - | + +[[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) + +# **create_order_export** +> OrdersExportCreateResponseBody create_order_export(orders_export_create_request_body=orders_export_create_request_body) + +Create Orders Export + +Creates a downloadable CSV file containing a list of orders. The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body. The available filters are all order object attributes. Additionally, any metadata defined in the metadata schema can be exported. Passing an empty JSON will generate a file containing three default fields: id, source_id, and status. The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.orders_export_create_request_body import OrdersExportCreateRequestBody +from voucherify.models.orders_export_create_response_body import OrdersExportCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.OrdersApi(api_client) + orders_export_create_request_body = {"parameters":{"fields":["id","source_id","status","created_at","updated_at","amount","discount_amount","items_discount_amount","total_discount_amount","total_amount","customer_id","referrer_id","metadata.payment_mean"]}} # OrdersExportCreateRequestBody | Specify which order parameters you would like to export. (optional) + + try: + # Create Orders Export + api_response = api_instance.create_order_export(orders_export_create_request_body=orders_export_create_request_body) + print("The response of OrdersApi->create_order_export:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrdersApi->create_order_export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orders_export_create_request_body** | [**OrdersExportCreateRequestBody**](OrdersExportCreateRequestBody.md)| Specify which order parameters you would like to export. | [optional] + +### Return type + +[**OrdersExportCreateResponseBody**](OrdersExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the `id` of the export object and `status` of the file generation process. The `id` is used in the <!-- [Get Export](OpenAPI.json/paths/~1exports~1{exportId}/get) -->[Get Export](ref:get-export) method to generate the url for the downloadable CSV file or in the <!-- [Download Export](OpenAPI.json/paths/~1exports~1{export_Id}/get) -->[Download Export](ref:download-export) method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation. | - | + +[[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) + +# **get_order** +> OrdersGetResponseBody get_order(order_id) + +Get Order + +Retrieve an order. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.orders_get_response_body import OrdersGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.OrdersApi(api_client) + order_id = 'order_id_example' # str | Unique Voucherify order ID or order source ID. + + try: + # Get Order + api_response = api_instance.get_order(order_id) + print("The response of OrdersApi->get_order:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrdersApi->get_order: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **str**| Unique Voucherify order ID or order source ID. | + +### Return type + +[**OrdersGetResponseBody**](OrdersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an order object if a valid identifier was provided. | - | + +[[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) + +# **import_orders** +> OrdersImportCreateResponseBody import_orders(orders_import_create_request_body_item=orders_import_create_request_body_item) + +Import Orders + + ๐Ÿšง Historical orders This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the create order and update order endpoints should be used. This is critical because this endpoint does not store events or launch distributions. # Limitations ## Import volume There can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one. ## Maximum count of orders in single import There is a 2000 limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time. # Notifications There are no notifications on the Dashboard because this import is launched via the API. # Triggered actions If you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segments summary. Consequently, this update will trigger - **customers entering into segments** - **distributions** based on any rules tied to customer entering segment(s) - **earning rules** based on the customer entering segment(s) # What is not triggered 1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. 2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a PAID status, the distribution is not going to be triggered. 3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you wont see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / skus, then you wont see the Product created events listed, etc. 4. Earning rules based on Order Paid wont be triggered. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.orders_import_create_request_body_item import OrdersImportCreateRequestBodyItem +from voucherify.models.orders_import_create_response_body import OrdersImportCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.OrdersApi(api_client) + orders_import_create_request_body_item = [{"source_id":"orderImport14","status":"PAID","metadata":{"location_id":["L1","L2"],"payment_mean":["paypal","credit-card"]},"customer":{"source_id":"bob2.smith@email.com","name":"Bob Smith","description":"A nice customer","email":"bob.smith@email.com","phone":"+1 933 222 3333","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":true},"birthdate":"2022-01-01"},"referrer":{"source_id":"jane.smith@email.com","name":"Jane Smith","description":"A really nice customer","email":"jane.smith@email.com","phone":"+1 933 222 3334","address":{"city":"New York","country":"United States","line_1":"123 Main St.","line_2":"APT 3 BLG 4","postal_code":"10001","state":"NY"},"metadata":{"lang":"en","test":false},"birthday":"2022-03-03"},"items":[{"source_id":"prod_1","related_object":"product","quantity":2,"product":{"name":"Apple iPhone 12","price":70000,"metadata":{"color":["silver"],"vendor":"mall"},"override":true}},{"source_id":"ComicBook_1","related_object":"sku","quantity":1,"product":{"source_id":"Books","name":"Comic Books1","price":1600,"metadata":{"color":["silver"],"vendor":"Bookstore1"},"override":true},"sku":{"sku":"Comics1","source_id":"ComicBook_1","price":1600,"metadata":{"color":["golden"],"vendor":"islands"},"override":true}}]},{"source_id":"orderImport15","status":"PAID","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"customer":{"source_id":"bob2.smith@email.com"},"referrer":{"source_id":"jane.smith@email.com"},"items":[{"source_id":"ComicBook_1","quantity":4,"related_object":"sku","sku":{"source_id":"ComicBook_1"}},{"source_id":"vase_1","quantity":1,"related_object":"product","product":{"source_id":"vase_1"}}]},{"source_id":"orderImport16","status":"FULFILLED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"customer":{"id":"cust_LMY4ZylSdUYB1J4tzqNcl5VV"},"referrer":{"id":"cust_Vzck5i8U3OhcEUFY6MKhN9Rv"},"items":[{"product_id":"prod_0b72b0bd64d198e3ae","quantity":2},{"sku_id":"sku_0b1621b319d248b79f","quantity":2}]},{"source_id":"orderImport17","status":"CANCELED","amount":7000,"metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]}},{"source_id":"orderImport18","status":"CREATED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"items":[{"source_id":"ComicBook_1","amount":900,"related_object":"sku"},{"source_id":"vase_1","amount":2000,"related_object":"product"}]},{"source_id":"orderImport19","status":"CREATED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"items":[{"amount":900},{"amount":2000}]},{"source_id":"orderImport20","status":"CREATED","metadata":{"location_id":["L3"],"payment_mean":["wire-transfer"]},"items":[{"price":900,"quantity":2},{"price":2000,"quantity":3}]}] # List[OrdersImportCreateRequestBodyItem] | The request body is sent in the form of an array of order objects. (optional) + + try: + # Import Orders + api_response = api_instance.import_orders(orders_import_create_request_body_item=orders_import_create_request_body_item) + print("The response of OrdersApi->import_orders:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrdersApi->import_orders: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orders_import_create_request_body_item** | [**List[OrdersImportCreateRequestBodyItem]**](OrdersImportCreateRequestBodyItem.md)| The request body is sent in the form of an array of order objects. | [optional] + +### Return type + +[**OrdersImportCreateResponseBody**](OrdersImportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the order(s) will be added to the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **list_orders** +> OrdersListResponseBody list_orders(limit=limit, page=page, order=order) + +List Orders + +Returns a list of orders. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.orders_list_response_body import OrdersListResponseBody +from voucherify.models.parameter_order_list_orders import ParameterOrderListOrders +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.OrdersApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListOrders() # ParameterOrderListOrders | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Orders + api_response = api_instance.list_orders(limit=limit, page=page, order=order) + print("The response of OrdersApi->list_orders:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrdersApi->list_orders: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListOrders**](.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**OrdersListResponseBody**](OrdersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with order objects. The orders are returned sorted by creation date by default, with the most recent orders appearing last, unless you specify another sequence using the order query parameter. | - | + +[[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) + +# **update_order** +> OrdersUpdateResponseBody update_order(order_id, orders_update_request_body=orders_update_request_body) + +Update Order + +Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.orders_update_request_body import OrdersUpdateRequestBody +from voucherify.models.orders_update_response_body import OrdersUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.OrdersApi(api_client) + order_id = 'order_id_example' # str | Unique Voucherify order ID or order source ID. + orders_update_request_body = {"status":"CANCELED"} # OrdersUpdateRequestBody | Specify the parameters of the order that are to be updated. (optional) + + try: + # Update Order + api_response = api_instance.update_order(order_id, orders_update_request_body=orders_update_request_body) + print("The response of OrdersApi->update_order:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrdersApi->update_order: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **str**| Unique Voucherify order ID or order source ID. | + **orders_update_request_body** | [**OrdersUpdateRequestBody**](OrdersUpdateRequestBody.md)| Specify the parameters of the order that are to be updated. | [optional] + +### Return type + +[**OrdersUpdateResponseBody**](OrdersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the order object if the update succeeded. | - | + +[[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) + diff --git a/docs/OrdersCreateRequestBody.md b/docs/OrdersCreateRequestBody.md new file mode 100644 index 00000000..61f38105 --- /dev/null +++ b/docs/OrdersCreateRequestBody.md @@ -0,0 +1,24 @@ +# OrdersCreateRequestBody + +Request body schema for **POST** `v1/orders`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**List[OrderItem]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**referrer** | [**Referrer**](Referrer.md) | | [optional] + +[[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/OrdersCreateResponseBody.md b/docs/OrdersCreateResponseBody.md new file mode 100644 index 00000000..050a2ab5 --- /dev/null +++ b/docs/OrdersCreateResponseBody.md @@ -0,0 +1,34 @@ +# OrdersCreateResponseBody + +Response body schema for **POST** `v1/orders`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**List[OrderCalculatedItem]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | **object** | | [optional] + +[[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/OrdersExportCreateRequestBody.md b/docs/OrdersExportCreateRequestBody.md new file mode 100644 index 00000000..f0cd4c57 --- /dev/null +++ b/docs/OrdersExportCreateRequestBody.md @@ -0,0 +1,13 @@ +# OrdersExportCreateRequestBody + +Request body schema for **POST** `v1/orders/export`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**OrdersExportCreateRequestBodyParameters**](OrdersExportCreateRequestBodyParameters.md) | | [optional] + +[[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/OrdersExportCreateRequestBodyParameters.md b/docs/OrdersExportCreateRequestBodyParameters.md new file mode 100644 index 00000000..d61a5fa2 --- /dev/null +++ b/docs/OrdersExportCreateRequestBodyParameters.md @@ -0,0 +1,15 @@ +# OrdersExportCreateRequestBodyParameters + +List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | [**ExportOrderOrder**](ExportOrderOrder.md) | | [optional] +**fields** | [**List[ExportOrderFields]**](ExportOrderFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | **object** | Allowed additional properties must start with \"metadata.\" | [optional] + +[[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/OrdersExportCreateResponseBody.md b/docs/OrdersExportCreateResponseBody.md new file mode 100644 index 00000000..acb53fd9 --- /dev/null +++ b/docs/OrdersExportCreateResponseBody.md @@ -0,0 +1,21 @@ +# OrdersExportCreateResponseBody + +Response body schema for **POST** `v1/orders/export`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique export ID. | [optional] +**object** | **str** | The type of object being represented. This object stores information about the export. | [optional] [default to 'export'] +**created_at** | **datetime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **str** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **str** | The channel through which the export was triggered. | [optional] +**result** | **object** | Contains the URL of the CSV file. | [optional] +**user_id** | **str** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE. | [optional] +**exported_object** | **str** | The type of object to be exported. | [optional] [default to 'order'] +**parameters** | [**OrdersExportCreateResponseBodyParameters**](OrdersExportCreateResponseBodyParameters.md) | | [optional] + +[[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/OrdersExportCreateResponseBodyParameters.md b/docs/OrdersExportCreateResponseBodyParameters.md new file mode 100644 index 00000000..c533943d --- /dev/null +++ b/docs/OrdersExportCreateResponseBodyParameters.md @@ -0,0 +1,15 @@ +# OrdersExportCreateResponseBodyParameters + +List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | [**ExportOrderOrder**](ExportOrderOrder.md) | | [optional] +**fields** | [**List[ExportOrderFields]**](ExportOrderFields.md) | Array of strings containing the data in the export. These fields define the headers in the CSV file. | [optional] +**filters** | **object** | Allowed additional properties must start with \"metadata.\" | [optional] + +[[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/OrdersGetResponseBody.md b/docs/OrdersGetResponseBody.md new file mode 100644 index 00000000..4ab3e814 --- /dev/null +++ b/docs/OrdersGetResponseBody.md @@ -0,0 +1,34 @@ +# OrdersGetResponseBody + +Response body schema for **GET** `v1/orders/{orderId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**List[OrderCalculatedItem]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | **object** | | [optional] + +[[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/OrdersImportCreateRequestBodyItem.md b/docs/OrdersImportCreateRequestBodyItem.md new file mode 100644 index 00000000..a5758f06 --- /dev/null +++ b/docs/OrdersImportCreateRequestBodyItem.md @@ -0,0 +1,23 @@ +# OrdersImportCreateRequestBodyItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**List[OrderItem]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**referrer** | [**Referrer**](Referrer.md) | | [optional] + +[[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/OrdersImportCreateResponseBody.md b/docs/OrdersImportCreateResponseBody.md new file mode 100644 index 00000000..a2f2b603 --- /dev/null +++ b/docs/OrdersImportCreateResponseBody.md @@ -0,0 +1,13 @@ +# OrdersImportCreateResponseBody + +Response body schema for **POST** `v1/orders/import`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/OrdersListResponseBody.md b/docs/OrdersListResponseBody.md new file mode 100644 index 00000000..47a2636b --- /dev/null +++ b/docs/OrdersListResponseBody.md @@ -0,0 +1,16 @@ +# OrdersListResponseBody + +Response body schema representing **GET** `v1/orders`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about orders in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of order objects. | [optional] [default to 'orders'] +**orders** | [**List[OrderCalculated]**](OrderCalculated.md) | Contains array of order objects. | [optional] +**total** | **int** | Total number of orders. | [optional] + +[[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/OrdersUpdateRequestBody.md b/docs/OrdersUpdateRequestBody.md new file mode 100644 index 00000000..258d73bd --- /dev/null +++ b/docs/OrdersUpdateRequestBody.md @@ -0,0 +1,23 @@ +# OrdersUpdateRequestBody + +Request body schema for **PUT** `v1/orders/{orderId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items** | [**List[OrderItem]**](OrderItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**referrer** | [**Referrer**](Referrer.md) | | [optional] + +[[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/OrdersUpdateResponseBody.md b/docs/OrdersUpdateResponseBody.md new file mode 100644 index 00000000..ae959d1e --- /dev/null +++ b/docs/OrdersUpdateResponseBody.md @@ -0,0 +1,34 @@ +# OrdersUpdateResponseBody + +Response body schema for **PUT** `v1/orders/{orderId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**List[OrderCalculatedItem]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**CustomerId**](CustomerId.md) | | [optional] +**referrer** | [**ReferrerId**](ReferrerId.md) | | [optional] +**redemptions** | **object** | | [optional] + +[[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/ParameterActivityCategory.md b/docs/ParameterActivityCategory.md new file mode 100644 index 00000000..f19feaf0 --- /dev/null +++ b/docs/ParameterActivityCategory.md @@ -0,0 +1,12 @@ +# ParameterActivityCategory + + +## Enum + +* `ACTION` (value: `'ACTION'`) + +* `EFFECT` (value: `'EFFECT'`) + +[[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/ParameterCampaignType.md b/docs/ParameterCampaignType.md new file mode 100644 index 00000000..d015eb96 --- /dev/null +++ b/docs/ParameterCampaignType.md @@ -0,0 +1,20 @@ +# ParameterCampaignType + + +## Enum + +* `PROMOTION` (value: `'PROMOTION'`) + +* `GIFT_VOUCHERS` (value: `'GIFT_VOUCHERS'`) + +* `REFERRAL_PROGRAM` (value: `'REFERRAL_PROGRAM'`) + +* `DISCOUNT_COUPONS` (value: `'DISCOUNT_COUPONS'`) + +* `LOYALTY_PROGRAM` (value: `'LOYALTY_PROGRAM'`) + +* `LUCKY_DRAW` (value: `'LUCKY_DRAW'`) + +[[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/ParameterCreatedBeforeAfter.md b/docs/ParameterCreatedBeforeAfter.md new file mode 100644 index 00000000..6be05fd0 --- /dev/null +++ b/docs/ParameterCreatedBeforeAfter.md @@ -0,0 +1,13 @@ +# ParameterCreatedBeforeAfter + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**before** | **datetime** | Timestamp representing the date and time before the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**after** | **datetime** | Timestamp representing the date and time after the voucher was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/ParameterExpandListCampaigns.md b/docs/ParameterExpandListCampaigns.md new file mode 100644 index 00000000..71b8fe36 --- /dev/null +++ b/docs/ParameterExpandListCampaigns.md @@ -0,0 +1,10 @@ +# ParameterExpandListCampaigns + + +## Enum + +* `CATEGORY` (value: `'category'`) + +[[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/ParameterFiltersListCustomerRedeemables.md b/docs/ParameterFiltersListCustomerRedeemables.md new file mode 100644 index 00000000..98e6bf23 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemables.md @@ -0,0 +1,19 @@ +# ParameterFiltersListCustomerRedeemables + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | [**ParameterFiltersListCustomerRedeemablesId**](ParameterFiltersListCustomerRedeemablesId.md) | | [optional] +**created_at** | [**ParameterFiltersListCustomerRedeemablesCreatedAt**](ParameterFiltersListCustomerRedeemablesCreatedAt.md) | | [optional] +**redeemable_id** | [**ParameterFiltersListCustomerRedeemablesRedeemableId**](ParameterFiltersListCustomerRedeemablesRedeemableId.md) | | [optional] +**redeemable_object** | [**ParameterFiltersListCustomerRedeemablesRedeemableObject**](ParameterFiltersListCustomerRedeemablesRedeemableObject.md) | | [optional] +**holder_role** | [**ParameterFiltersListCustomerRedeemablesHolderRole**](ParameterFiltersListCustomerRedeemablesHolderRole.md) | | [optional] +**campaign_id** | [**ParameterFiltersListCustomerRedeemablesCampaignId**](ParameterFiltersListCustomerRedeemablesCampaignId.md) | | [optional] +**campaign_type** | [**ParameterFiltersListCustomerRedeemablesCampaignType**](ParameterFiltersListCustomerRedeemablesCampaignType.md) | | [optional] +**voucher_type** | [**ParameterFiltersListCustomerRedeemablesVoucherType**](ParameterFiltersListCustomerRedeemablesVoucherType.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesCampaignId.md b/docs/ParameterFiltersListCustomerRedeemablesCampaignId.md new file mode 100644 index 00000000..afdc296a --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCampaignId.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesCampaignId + +Unique campaign identifer, e.g. `camp_bfrwAVsP6Q1EM1ZjgHwheKYr`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesCampaignType.md b/docs/ParameterFiltersListCustomerRedeemablesCampaignType.md new file mode 100644 index 00000000..9f3201f4 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCampaignType.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesCampaignType + +Type of the campaign. Allowed values: `DISCOUNT_COUPONS`, `REFERRAL_PROGRAM`, `GIFT_VOUCHERS`, `LOYALTY_PROGRAM` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**ParameterFiltersListCustomerRedeemablesCampaignTypeConditions**](ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md b/docs/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md new file mode 100644 index 00000000..fab812ad --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.md @@ -0,0 +1,19 @@ +# ParameterFiltersListCustomerRedeemablesCampaignTypeConditions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**not_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**var_is** | **str** | Value is exactly this value (single value). | [optional] +**is_not** | **str** | Results omit this value (single value). | [optional] +**has_value** | **str** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**is_unknown** | **str** | Value is null. The value for this parameter is an empty string. | [optional] +**starts_with** | **str** | Value starts with the specified string. | [optional] +**ends_with** | **str** | Value ends with the specified string. | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesCreatedAt.md b/docs/ParameterFiltersListCustomerRedeemablesCreatedAt.md new file mode 100644 index 00000000..b7c56e20 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCreatedAt.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesCreatedAt + +Timestamp representing the date and time when the customer redeemable was created. The value is shown in the ISO 8601 format. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**ParameterFiltersListCustomerRedeemablesCreatedAtConditions**](ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md b/docs/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md new file mode 100644 index 00000000..7b4df3ef --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesCreatedAtConditions.md @@ -0,0 +1,18 @@ +# ParameterFiltersListCustomerRedeemablesCreatedAtConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**after** | **datetime** | Value is after this date. The value for this parameter is shown in the ISO 8601 format. | [optional] +**before** | **datetime** | Value is before this date. The value for this parameter is shown in the ISO 8601 format. | [optional] +**has_value** | **str** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**is_unknown** | **str** | Value is null. The value for this parameter is an empty string. | [optional] +**more_than** | **int** | Value is more days ago before the current date and time, e.g. more than `10` days ago. | [optional] +**less_than** | **int** | Value is less days before the current date and time, e.g. less than `10` days ago. | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesHolderRole.md b/docs/ParameterFiltersListCustomerRedeemablesHolderRole.md new file mode 100644 index 00000000..6402612e --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesHolderRole.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesHolderRole + +Holder role of the redeemable. Allowed values: `OWNER`, `REFEREE`, `REFERRER`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**ParameterFiltersListCustomerRedeemablesHolderRoleConditions**](ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md b/docs/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md new file mode 100644 index 00000000..46837dc5 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesHolderRoleConditions.md @@ -0,0 +1,19 @@ +# ParameterFiltersListCustomerRedeemablesHolderRoleConditions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**not_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**var_is** | **str** | Value is exactly this value (single value). | [optional] +**is_not** | **str** | Results omit this value (single value). | [optional] +**has_value** | **str** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**is_unknown** | **str** | Value is null. The value for this parameter is an empty string. | [optional] +**starts_with** | **str** | Value starts with the specified string. | [optional] +**ends_with** | **str** | Value ends with the specified string. | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesId.md b/docs/ParameterFiltersListCustomerRedeemablesId.md new file mode 100644 index 00000000..3ff69a7c --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesId.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesId + +Unique redeemable holder ID, i.e. `rh_0e77502f84f0f4a6a8`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesRedeemableId.md b/docs/ParameterFiltersListCustomerRedeemablesRedeemableId.md new file mode 100644 index 00000000..77dadbe5 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesRedeemableId.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesRedeemableId + +Unique redeemable ID, e.g. `v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesRedeemableObject.md b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObject.md new file mode 100644 index 00000000..268256f1 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObject.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesRedeemableObject + +Unique related object, i.e. `voucher`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions**](ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md new file mode 100644 index 00000000..52bec827 --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.md @@ -0,0 +1,19 @@ +# ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**not_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**var_is** | **str** | Value is exactly this value (single value). | [optional] [default to 'voucher'] +**is_not** | **str** | Results omit this value (single value). | [optional] [default to 'voucher'] +**has_value** | **str** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**is_unknown** | **str** | Value is null. The value for this parameter is an empty string. | [optional] +**starts_with** | **str** | Value starts with the specified string. | [optional] +**ends_with** | **str** | Value ends with the specified string. | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesVoucherType.md b/docs/ParameterFiltersListCustomerRedeemablesVoucherType.md new file mode 100644 index 00000000..2f1f218b --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesVoucherType.md @@ -0,0 +1,14 @@ +# ParameterFiltersListCustomerRedeemablesVoucherType + +Type of the voucher. Allowed values: `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**ParameterFiltersListCustomerRedeemablesVoucherTypeConditions**](ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md b/docs/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md new file mode 100644 index 00000000..bfbf19bb --- /dev/null +++ b/docs/ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.md @@ -0,0 +1,19 @@ +# ParameterFiltersListCustomerRedeemablesVoucherTypeConditions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**not_in** | **List[str]** | Array of resource values that should be included in the results (multiple values). | [optional] +**var_is** | **str** | Value is exactly this value (single value). | [optional] +**is_not** | **str** | Results omit this value (single value). | [optional] +**has_value** | **str** | Value is NOT null. The value for this parameter is an empty string. | [optional] +**is_unknown** | **str** | Value is null. The value for this parameter is an empty string. | [optional] +**starts_with** | **str** | Value starts with the specified string. | [optional] +**ends_with** | **str** | Value ends with the specified string. | [optional] + +[[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/ParameterFiltersListRedemptions.md b/docs/ParameterFiltersListRedemptions.md new file mode 100644 index 00000000..35ef19e3 --- /dev/null +++ b/docs/ParameterFiltersListRedemptions.md @@ -0,0 +1,21 @@ +# ParameterFiltersListRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucher_code** | [**ParameterFiltersListRedemptionsVoucherCode**](ParameterFiltersListRedemptionsVoucherCode.md) | | [optional] +**related_object_id** | [**ParameterFiltersListRedemptionsRelatedObjectId**](ParameterFiltersListRedemptionsRelatedObjectId.md) | | [optional] +**related_object_parent_id** | [**ParameterFiltersListRedemptionsRelatedObjectParentId**](ParameterFiltersListRedemptionsRelatedObjectParentId.md) | | [optional] +**parent_redemption_id** | [**ParameterFiltersListRedemptionsParentRedemptionId**](ParameterFiltersListRedemptionsParentRedemptionId.md) | | [optional] +**failure_code** | [**ParameterFiltersListRedemptionsFailureCode**](ParameterFiltersListRedemptionsFailureCode.md) | | [optional] +**result** | [**ParameterFiltersListRedemptionsResult**](ParameterFiltersListRedemptionsResult.md) | | [optional] +**object** | [**ParameterFiltersListRedemptionsObject**](ParameterFiltersListRedemptionsObject.md) | | [optional] +**customer_id** | [**ParameterFiltersListRedemptionsCustomerId**](ParameterFiltersListRedemptionsCustomerId.md) | | [optional] +**campaign_name** | [**ParameterFiltersListRedemptionsCampaignName**](ParameterFiltersListRedemptionsCampaignName.md) | | [optional] +**user_login** | [**ParameterFiltersListRedemptionsUserLogin**](ParameterFiltersListRedemptionsUserLogin.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsCampaignName.md b/docs/ParameterFiltersListRedemptionsCampaignName.md new file mode 100644 index 00000000..a135fc5c --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsCampaignName.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsCampaignName + +Campaign name. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsCustomerId.md b/docs/ParameterFiltersListRedemptionsCustomerId.md new file mode 100644 index 00000000..382d7761 --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsCustomerId.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsCustomerId + +Unique customer ID, i.e. cust_sehkNIi8Uq2qQuRqSr7xn4Zi. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsFailureCode.md b/docs/ParameterFiltersListRedemptionsFailureCode.md new file mode 100644 index 00000000..76eee48f --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsFailureCode.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsFailureCode + +Failure code, i.e. quantity_exceeded. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsObject.md b/docs/ParameterFiltersListRedemptionsObject.md new file mode 100644 index 00000000..300a54c6 --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsObject.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsObject + +Specify which type of object to return, i.e. `redemption` or `redemption_rollback`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsParentRedemptionId.md b/docs/ParameterFiltersListRedemptionsParentRedemptionId.md new file mode 100644 index 00000000..228f595d --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsParentRedemptionId.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsParentRedemptionId + +Unique parent redemption ID, i.e. r_0c5952900bcbfd54b6. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsRelatedObjectId.md b/docs/ParameterFiltersListRedemptionsRelatedObjectId.md new file mode 100644 index 00000000..a4f7630c --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsRelatedObjectId.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsRelatedObjectId + +Unique related object ID, i.e. v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsRelatedObjectParentId.md b/docs/ParameterFiltersListRedemptionsRelatedObjectParentId.md new file mode 100644 index 00000000..8cdcfcb0 --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsRelatedObjectParentId.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsRelatedObjectParentId + +Unique related object parent ID, i.e. camp_22noMlhTADb7Fq2UL3vWu3d1. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsResult.md b/docs/ParameterFiltersListRedemptionsResult.md new file mode 100644 index 00000000..788162b0 --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsResult.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsResult + +Result, i.e. `SUCCESS` or `FAILURE`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsUserLogin.md b/docs/ParameterFiltersListRedemptionsUserLogin.md new file mode 100644 index 00000000..3fdb5994 --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsUserLogin.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsUserLogin + +User login used to login to Voucherify, i.e. name.lastname@email.com + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterFiltersListRedemptionsVoucherCode.md b/docs/ParameterFiltersListRedemptionsVoucherCode.md new file mode 100644 index 00000000..922acdb8 --- /dev/null +++ b/docs/ParameterFiltersListRedemptionsVoucherCode.md @@ -0,0 +1,14 @@ +# ParameterFiltersListRedemptionsVoucherCode + +Unique voucher code. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**FilterConditionsString**](FilterConditionsString.md) | | [optional] +**junction** | [**Junction**](Junction.md) | | [optional] + +[[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/ParameterOrder.md b/docs/ParameterOrder.md new file mode 100644 index 00000000..7f3c5c2f --- /dev/null +++ b/docs/ParameterOrder.md @@ -0,0 +1,32 @@ +# ParameterOrder + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +* `TYPE` (value: `'type'`) + +* `MINUS_TYPE` (value: `'-type'`) + +* `CODE` (value: `'code'`) + +* `MINUS_CODE` (value: `'-code'`) + +* `CAMPAIGN` (value: `'campaign'`) + +* `MINUS_CAMPAIGN` (value: `'-campaign'`) + +* `CATEGORY` (value: `'category'`) + +* `MINUS_CATEGORY` (value: `'-category'`) + +[[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/ParameterOrderCreatedAt.md b/docs/ParameterOrderCreatedAt.md new file mode 100644 index 00000000..3d433c57 --- /dev/null +++ b/docs/ParameterOrderCreatedAt.md @@ -0,0 +1,12 @@ +# ParameterOrderCreatedAt + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +[[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/ParameterOrderListAllPromotionStacks.md b/docs/ParameterOrderListAllPromotionStacks.md new file mode 100644 index 00000000..3eab1af5 --- /dev/null +++ b/docs/ParameterOrderListAllPromotionStacks.md @@ -0,0 +1,20 @@ +# ParameterOrderListAllPromotionStacks + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +* `NAME` (value: `'name'`) + +* `MINUS_NAME` (value: `'-name'`) + +[[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/ParameterOrderListCampaigns.md b/docs/ParameterOrderListCampaigns.md new file mode 100644 index 00000000..4487a3cf --- /dev/null +++ b/docs/ParameterOrderListCampaigns.md @@ -0,0 +1,16 @@ +# ParameterOrderListCampaigns + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +[[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/ParameterOrderListCustomers.md b/docs/ParameterOrderListCustomers.md new file mode 100644 index 00000000..c2902989 --- /dev/null +++ b/docs/ParameterOrderListCustomers.md @@ -0,0 +1,20 @@ +# ParameterOrderListCustomers + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +* `SOURCE_ID` (value: `'source_id'`) + +* `MINUS_SOURCE_ID` (value: `'-source_id'`) + +[[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/ParameterOrderListEarningRules.md b/docs/ParameterOrderListEarningRules.md new file mode 100644 index 00000000..649f45e7 --- /dev/null +++ b/docs/ParameterOrderListEarningRules.md @@ -0,0 +1,16 @@ +# ParameterOrderListEarningRules + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +[[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/ParameterOrderListExports.md b/docs/ParameterOrderListExports.md new file mode 100644 index 00000000..c1f4195e --- /dev/null +++ b/docs/ParameterOrderListExports.md @@ -0,0 +1,16 @@ +# ParameterOrderListExports + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `STATUS` (value: `'status'`) + +* `MINUS_STATUS` (value: `'-status'`) + +[[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/ParameterOrderListLoyaltyTiers.md b/docs/ParameterOrderListLoyaltyTiers.md new file mode 100644 index 00000000..df0de9c9 --- /dev/null +++ b/docs/ParameterOrderListLoyaltyTiers.md @@ -0,0 +1,16 @@ +# ParameterOrderListLoyaltyTiers + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +[[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/ParameterOrderListOrders.md b/docs/ParameterOrderListOrders.md new file mode 100644 index 00000000..5446a772 --- /dev/null +++ b/docs/ParameterOrderListOrders.md @@ -0,0 +1,16 @@ +# ParameterOrderListOrders + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +[[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/ParameterOrderListPromotionTiers.md b/docs/ParameterOrderListPromotionTiers.md new file mode 100644 index 00000000..7b96d752 --- /dev/null +++ b/docs/ParameterOrderListPromotionTiers.md @@ -0,0 +1,16 @@ +# ParameterOrderListPromotionTiers + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +[[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/ParameterOrderListPromotionTiersClientSide.md b/docs/ParameterOrderListPromotionTiersClientSide.md new file mode 100644 index 00000000..cad765aa --- /dev/null +++ b/docs/ParameterOrderListPromotionTiersClientSide.md @@ -0,0 +1,16 @@ +# ParameterOrderListPromotionTiersClientSide + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +[[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/ParameterOrderListPublications.md b/docs/ParameterOrderListPublications.md new file mode 100644 index 00000000..21f76b7d --- /dev/null +++ b/docs/ParameterOrderListPublications.md @@ -0,0 +1,32 @@ +# ParameterOrderListPublications + + +## Enum + +* `ID` (value: `'id'`) + +* `MINUS_ID` (value: `'-id'`) + +* `VOUCHER_CODE` (value: `'voucher_code'`) + +* `MINUS_VOUCHER_CODE` (value: `'-voucher_code'`) + +* `TRACKING_ID` (value: `'tracking_id'`) + +* `MINUS_TRACKING_ID` (value: `'-tracking_id'`) + +* `CUSTOMER_ID` (value: `'customer_id'`) + +* `MINUS_CUSTOMER_ID` (value: `'-customer_id'`) + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `CHANNEL` (value: `'channel'`) + +* `MINUS_CHANNEL` (value: `'-channel'`) + +[[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/ParameterOrderListRedeemables.md b/docs/ParameterOrderListRedeemables.md new file mode 100644 index 00000000..2c808269 --- /dev/null +++ b/docs/ParameterOrderListRedeemables.md @@ -0,0 +1,12 @@ +# ParameterOrderListRedeemables + + +## Enum + +* `ID` (value: `'id'`) + +* `MINUS_ID` (value: `'-id'`) + +[[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/ParameterOrderListRedemptions.md b/docs/ParameterOrderListRedemptions.md new file mode 100644 index 00000000..9848827a --- /dev/null +++ b/docs/ParameterOrderListRedemptions.md @@ -0,0 +1,28 @@ +# ParameterOrderListRedemptions + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `ID` (value: `'id'`) + +* `MINUS_ID` (value: `'-id'`) + +* `VOUCHER_CODE` (value: `'voucher_code'`) + +* `MINUS_VOUCHER_CODE` (value: `'-voucher_code'`) + +* `TRACKING_ID` (value: `'tracking_id'`) + +* `MINUS_TRACKING_ID` (value: `'-tracking_id'`) + +* `CUSTOMER_ID` (value: `'customer_id'`) + +* `MINUS_CUSTOMER_ID` (value: `'-customer_id'`) + +[[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/ParameterOrderListTransactions.md b/docs/ParameterOrderListTransactions.md new file mode 100644 index 00000000..7787fe36 --- /dev/null +++ b/docs/ParameterOrderListTransactions.md @@ -0,0 +1,12 @@ +# ParameterOrderListTransactions + + +## Enum + +* `ID` (value: `'id'`) + +* `MINUS_ID` (value: `'-id'`) + +[[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/ParameterOrderListValidationRuleAssignments.md b/docs/ParameterOrderListValidationRuleAssignments.md new file mode 100644 index 00000000..5fa70428 --- /dev/null +++ b/docs/ParameterOrderListValidationRuleAssignments.md @@ -0,0 +1,12 @@ +# ParameterOrderListValidationRuleAssignments + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +[[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/ParameterOrderListValidationRules.md b/docs/ParameterOrderListValidationRules.md new file mode 100644 index 00000000..a700a925 --- /dev/null +++ b/docs/ParameterOrderListValidationRules.md @@ -0,0 +1,20 @@ +# ParameterOrderListValidationRules + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +* `NAME` (value: `'name'`) + +* `MINUS_NAME` (value: `'-name'`) + +[[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/ParameterOrderVouchers.md b/docs/ParameterOrderVouchers.md new file mode 100644 index 00000000..c05741af --- /dev/null +++ b/docs/ParameterOrderVouchers.md @@ -0,0 +1,20 @@ +# ParameterOrderVouchers + + +## Enum + +* `CREATED_AT` (value: `'created_at'`) + +* `MINUS_CREATED_AT` (value: `'-created_at'`) + +* `UPDATED_AT` (value: `'updated_at'`) + +* `MINUS_UPDATED_AT` (value: `'-updated_at'`) + +* `CODE` (value: `'code'`) + +* `MINUS_CODE` (value: `'-code'`) + +[[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/ParameterResultListPublications.md b/docs/ParameterResultListPublications.md new file mode 100644 index 00000000..d133ddc3 --- /dev/null +++ b/docs/ParameterResultListPublications.md @@ -0,0 +1,12 @@ +# ParameterResultListPublications + + +## Enum + +* `SUCCESS` (value: `'SUCCESS'`) + +* `FAILURE` (value: `'FAILURE'`) + +[[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/ParameterUpdatedBeforeAfter.md b/docs/ParameterUpdatedBeforeAfter.md new file mode 100644 index 00000000..571f1f6f --- /dev/null +++ b/docs/ParameterUpdatedBeforeAfter.md @@ -0,0 +1,13 @@ +# ParameterUpdatedBeforeAfter + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**before** | **datetime** | Timestamp representing the date and time before the voucher was updated. The value is shown in the ISO 8601 format. | [optional] +**after** | **datetime** | Timestamp representing the date and time after the voucher was updated. The value is shown in the ISO 8601 format. | [optional] + +[[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/ParameterVoucherTypeListPublications.md b/docs/ParameterVoucherTypeListPublications.md new file mode 100644 index 00000000..47f46c4e --- /dev/null +++ b/docs/ParameterVoucherTypeListPublications.md @@ -0,0 +1,14 @@ +# ParameterVoucherTypeListPublications + + +## Enum + +* `DISCOUNT` (value: `'discount'`) + +* `LOYALTY` (value: `'loyalty'`) + +* `LUCKY_DRAW` (value: `'lucky_draw'`) + +[[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/PointsExpirationTypes.md b/docs/PointsExpirationTypes.md new file mode 100644 index 00000000..76f1f1c1 --- /dev/null +++ b/docs/PointsExpirationTypes.md @@ -0,0 +1,14 @@ +# PointsExpirationTypes + + +## Enum + +* `PROGRAM_RULES` (value: `'PROGRAM_RULES'`) + +* `CUSTOM_DATE` (value: `'CUSTOM_DATE'`) + +* `NON_EXPIRING` (value: `'NON_EXPIRING'`) + +[[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/Product.md b/docs/Product.md new file mode 100644 index 00000000..f1aeac3a --- /dev/null +++ b/docs/Product.md @@ -0,0 +1,23 @@ +# Product + +This is an object representing a product. This entity should be used to map product items from your inventory management system. The aim of products is to build which reflect product-specific campaigns. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID assigned by Voucherify. | [optional] +**source_id** | **str** | Unique product source ID. | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] + +[[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/ProductCollectionsApi.md b/docs/ProductCollectionsApi.md new file mode 100644 index 00000000..a1d23c11 --- /dev/null +++ b/docs/ProductCollectionsApi.md @@ -0,0 +1,455 @@ +# voucherify.ProductCollectionsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_product_collection**](ProductCollectionsApi.md#create_product_collection) | **POST** /v1/product-collections | Create Product Collection +[**delete_product_collection**](ProductCollectionsApi.md#delete_product_collection) | **DELETE** /v1/product-collections/{productCollectionId} | Delete Product Collection +[**get_product_collection**](ProductCollectionsApi.md#get_product_collection) | **GET** /v1/product-collections/{productCollectionId} | Get Product Collection +[**list_product_collections**](ProductCollectionsApi.md#list_product_collections) | **GET** /v1/product-collections | List Product Collections +[**list_products_in_collection**](ProductCollectionsApi.md#list_products_in_collection) | **GET** /v1/product-collections/{productCollectionId}/products | List Products in Collection + + +# **create_product_collection** +> ProductCollectionsCreateResponseBody create_product_collection(product_collections_create_request_body=product_collections_create_request_body) + +Create Product Collection + +This method creates a new product collection. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.product_collections_create_request_body import ProductCollectionsCreateRequestBody +from voucherify.models.product_collections_create_response_body import ProductCollectionsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductCollectionsApi(api_client) + product_collections_create_request_body = voucherify.ProductCollectionsCreateRequestBody() # ProductCollectionsCreateRequestBody | (optional) + + try: + # Create Product Collection + api_response = api_instance.create_product_collection(product_collections_create_request_body=product_collections_create_request_body) + print("The response of ProductCollectionsApi->create_product_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductCollectionsApi->create_product_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_collections_create_request_body** | [**ProductCollectionsCreateRequestBody**](ProductCollectionsCreateRequestBody.md)| | [optional] + +### Return type + +[**ProductCollectionsCreateResponseBody**](ProductCollectionsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns information about the newly created collection, as well as an array containing the products. | - | + +[[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) + +# **delete_product_collection** +> delete_product_collection(product_collection_id) + +Delete Product Collection + +This method deletes a product collection. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductCollectionsApi(api_client) + product_collection_id = 'product_collection_id_example' # str | A unique product collection ID. + + try: + # Delete Product Collection + api_instance.delete_product_collection(product_collection_id) + except Exception as e: + print("Exception when calling ProductCollectionsApi->delete_product_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_collection_id** | **str**| A unique product collection ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **get_product_collection** +> ProductCollectionsGetResponseBody get_product_collection(product_collection_id) + +Get Product Collection + +Retrieves the product collection. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.product_collections_get_response_body import ProductCollectionsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductCollectionsApi(api_client) + product_collection_id = 'product_collection_id_example' # str | A unique product collection ID. + + try: + # Get Product Collection + api_response = api_instance.get_product_collection(product_collection_id) + print("The response of ProductCollectionsApi->get_product_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductCollectionsApi->get_product_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_collection_id** | **str**| A unique product collection ID. | + +### Return type + +[**ProductCollectionsGetResponseBody**](ProductCollectionsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a product collection object if a valid identifier was provided in the path. | - | + +[[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) + +# **list_product_collections** +> ProductCollectionsListResponseBody list_product_collections(limit=limit, page=page, order=order) + +List Product Collections + +This method returns a list of product collections. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.product_collections_list_response_body import ProductCollectionsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductCollectionsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrder() # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Product Collections + api_response = api_instance.list_product_collections(limit=limit, page=page, order=order) + print("The response of ProductCollectionsApi->list_product_collections:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductCollectionsApi->list_product_collections: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrder**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**ProductCollectionsListResponseBody**](ProductCollectionsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary containing a list of product collections and details about each product collection. | - | + +[[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) + +# **list_products_in_collection** +> ProductCollectionsProductsListResponseBody list_products_in_collection(product_collection_id, limit=limit, page=page, order=order, starting_after=starting_after) + +List Products in Collection + +Retrieves list of products from a product collection; works for both dynamic and static product collections. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.product_collections_products_list_response_body import ProductCollectionsProductsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductCollectionsApi(api_client) + product_collection_id = 'product_collection_id_example' # str | Unique product collection ID. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrder() # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. (optional) + + try: + # List Products in Collection + api_response = api_instance.list_products_in_collection(product_collection_id, limit=limit, page=page, order=order, starting_after=starting_after) + print("The response of ProductCollectionsApi->list_products_in_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductCollectionsApi->list_products_in_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_collection_id** | **str**| Unique product collection ID. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrder**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after** | **datetime**| Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. | [optional] + +### Return type + +[**ProductCollectionsProductsListResponseBody**](ProductCollectionsProductsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of products and/or SKUs grouped in the collection with each product's/SKU's details. | - | + +[[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) + diff --git a/docs/ProductCollectionsCreateRequestBody.md b/docs/ProductCollectionsCreateRequestBody.md new file mode 100644 index 00000000..545c00f8 --- /dev/null +++ b/docs/ProductCollectionsCreateRequestBody.md @@ -0,0 +1,15 @@ +# ProductCollectionsCreateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Show that the product collection is static (manually selected products). | [optional] [default to 'STATIC'] +**name** | **str** | Unique user-defined product collection name. | [optional] +**products** | [**List[ProductCollectionsCreateRequestBodyProductsItem]**](ProductCollectionsCreateRequestBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**filter** | [**ProductCollectionsCreateRequestBodyFilter**](ProductCollectionsCreateRequestBodyFilter.md) | | [optional] + +[[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/ProductCollectionsCreateRequestBodyFilter.md b/docs/ProductCollectionsCreateRequestBodyFilter.md new file mode 100644 index 00000000..5228ad57 --- /dev/null +++ b/docs/ProductCollectionsCreateRequestBodyFilter.md @@ -0,0 +1,25 @@ +# ProductCollectionsCreateRequestBodyFilter + +Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | +**id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] +**image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] +**updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ProductCollectionsCreateRequestBodyProductsItem.md b/docs/ProductCollectionsCreateRequestBodyProductsItem.md new file mode 100644 index 00000000..32fe4540 --- /dev/null +++ b/docs/ProductCollectionsCreateRequestBodyProductsItem.md @@ -0,0 +1,14 @@ +# ProductCollectionsCreateRequestBodyProductsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The product ID. | +**product_id** | **str** | Product ID for SKUs. | [optional] +**object** | **str** | Denotes the type of the object represented by the ID. | + +[[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/ProductCollectionsCreateResponseBody.md b/docs/ProductCollectionsCreateResponseBody.md new file mode 100644 index 00000000..06a9ef6f --- /dev/null +++ b/docs/ProductCollectionsCreateResponseBody.md @@ -0,0 +1,19 @@ +# ProductCollectionsCreateResponseBody + +Response body schema for **POST** `v1/product-collections`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Product collection ID. | [optional] +**name** | **str** | Unique user-defined product collection name. | [optional] +**type** | **str** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] +**filter** | [**ProductCollectionsCreateResponseBodyFilter**](ProductCollectionsCreateResponseBodyFilter.md) | | [optional] +**products** | [**List[ProductCollectionsCreateResponseBodyProductsItem]**](ProductCollectionsCreateResponseBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional] [default to 'products_collection'] + +[[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/ProductCollectionsCreateResponseBodyFilter.md b/docs/ProductCollectionsCreateResponseBodyFilter.md new file mode 100644 index 00000000..7664a36e --- /dev/null +++ b/docs/ProductCollectionsCreateResponseBodyFilter.md @@ -0,0 +1,25 @@ +# ProductCollectionsCreateResponseBodyFilter + +Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | +**id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] +**image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] +**updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ProductCollectionsCreateResponseBodyProductsItem.md b/docs/ProductCollectionsCreateResponseBodyProductsItem.md new file mode 100644 index 00000000..3daf1198 --- /dev/null +++ b/docs/ProductCollectionsCreateResponseBodyProductsItem.md @@ -0,0 +1,14 @@ +# ProductCollectionsCreateResponseBodyProductsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The product ID. | +**product_id** | **str** | Product ID for SKUs. | [optional] +**object** | **str** | Denotes the type of the object represented by the ID. | + +[[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/ProductCollectionsGetResponseBody.md b/docs/ProductCollectionsGetResponseBody.md new file mode 100644 index 00000000..10e2018d --- /dev/null +++ b/docs/ProductCollectionsGetResponseBody.md @@ -0,0 +1,19 @@ +# ProductCollectionsGetResponseBody + +Response body schema for **GET** `v1/product-collections/{productCollectionId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Product collection ID. | [optional] +**name** | **str** | Unique user-defined product collection name. | [optional] +**type** | **str** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] +**filter** | [**ProductCollectionsGetResponseBodyFilter**](ProductCollectionsGetResponseBodyFilter.md) | | [optional] +**products** | [**List[ProductCollectionsGetResponseBodyProductsItem]**](ProductCollectionsGetResponseBodyProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional] [default to 'products_collection'] + +[[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/ProductCollectionsGetResponseBodyFilter.md b/docs/ProductCollectionsGetResponseBodyFilter.md new file mode 100644 index 00000000..ae315114 --- /dev/null +++ b/docs/ProductCollectionsGetResponseBodyFilter.md @@ -0,0 +1,25 @@ +# ProductCollectionsGetResponseBodyFilter + +Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | +**id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] +**image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] +**updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ProductCollectionsGetResponseBodyProductsItem.md b/docs/ProductCollectionsGetResponseBodyProductsItem.md new file mode 100644 index 00000000..21c776b6 --- /dev/null +++ b/docs/ProductCollectionsGetResponseBodyProductsItem.md @@ -0,0 +1,14 @@ +# ProductCollectionsGetResponseBodyProductsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The product ID. | +**product_id** | **str** | Product ID for SKUs. | [optional] +**object** | **str** | Denotes the type of the object represented by the ID. | + +[[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/ProductCollectionsItem.md b/docs/ProductCollectionsItem.md new file mode 100644 index 00000000..a63357ff --- /dev/null +++ b/docs/ProductCollectionsItem.md @@ -0,0 +1,19 @@ +# ProductCollectionsItem + +This is an object representing a product collection base. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Product collection ID. | [optional] +**name** | **str** | Unique user-defined product collection name. | [optional] +**type** | **str** | Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products). | [optional] +**filter** | [**ProductCollectionsItemFilter**](ProductCollectionsItemFilter.md) | | [optional] +**products** | [**List[ProductCollectionsItemProductsItem]**](ProductCollectionsItemProductsItem.md) | Defines a set of products for a `STATIC` product collection type. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the static product collection. | [optional] [default to 'products_collection'] + +[[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/ProductCollectionsItemFilter.md b/docs/ProductCollectionsItemFilter.md new file mode 100644 index 00000000..ec0ca8ab --- /dev/null +++ b/docs/ProductCollectionsItemFilter.md @@ -0,0 +1,25 @@ +# ProductCollectionsItemFilter + +Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | +**id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**product_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**source_id** | [**FieldConditions**](FieldConditions.md) | | [optional] +**name** | [**FieldConditions**](FieldConditions.md) | | [optional] +**price** | [**FieldConditions**](FieldConditions.md) | | [optional] +**object** | [**FieldConditions**](FieldConditions.md) | | [optional] +**attributes** | [**FieldConditions**](FieldConditions.md) | | [optional] +**metadata** | [**FieldConditions**](FieldConditions.md) | | [optional] +**image_url** | [**FieldConditions**](FieldConditions.md) | | [optional] +**skus** | [**FieldConditions**](FieldConditions.md) | | [optional] +**created_at** | [**FieldConditions**](FieldConditions.md) | | [optional] +**updated_at** | [**FieldConditions**](FieldConditions.md) | | [optional] + +[[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/ProductCollectionsItemProductsItem.md b/docs/ProductCollectionsItemProductsItem.md new file mode 100644 index 00000000..3dd019d8 --- /dev/null +++ b/docs/ProductCollectionsItemProductsItem.md @@ -0,0 +1,14 @@ +# ProductCollectionsItemProductsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The product ID. | +**product_id** | **str** | Product ID for SKUs. | [optional] +**object** | **str** | Denotes the type of the object represented by the ID. | + +[[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/ProductCollectionsListResponseBody.md b/docs/ProductCollectionsListResponseBody.md new file mode 100644 index 00000000..a334d536 --- /dev/null +++ b/docs/ProductCollectionsListResponseBody.md @@ -0,0 +1,16 @@ +# ProductCollectionsListResponseBody + +Response body schema for **GET** `v1/product-collections`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about product collections. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of product collections. | [optional] [default to 'data'] +**data** | [**List[ProductCollectionsItem]**](ProductCollectionsItem.md) | A dictionary that contains an array of product collections and their details. | [optional] +**total** | **int** | Total number of product collections. | [optional] + +[[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/ProductCollectionsProductsListResponseBody.md b/docs/ProductCollectionsProductsListResponseBody.md new file mode 100644 index 00000000..05570362 --- /dev/null +++ b/docs/ProductCollectionsProductsListResponseBody.md @@ -0,0 +1,16 @@ +# ProductCollectionsProductsListResponseBody + +Response body schema for **GET** `v1/product-collections/{productCollectionId}/products`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about products and SKUs. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of products and SKUs. | [optional] [default to 'data'] +**data** | [**List[ProductCollectionsProductsListResponseBodyDataItem]**](ProductCollectionsProductsListResponseBodyDataItem.md) | | [optional] +**total** | **int** | Total number of products & SKUs in the product collection. | [optional] + +[[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/ProductCollectionsProductsListResponseBodyDataItem.md b/docs/ProductCollectionsProductsListResponseBodyDataItem.md new file mode 100644 index 00000000..a95115f7 --- /dev/null +++ b/docs/ProductCollectionsProductsListResponseBodyDataItem.md @@ -0,0 +1,25 @@ +# ProductCollectionsProductsListResponseBodyDataItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**source_id** | **str** | | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | | [optional] +**image_url** | **str** | | [optional] +**created_at** | **str** | | [optional] +**updated_at** | **str** | | [optional] +**object** | **str** | | [optional] +**product_id** | **str** | The parent product's unique ID. | [optional] +**sku** | **str** | Unique user-defined SKU name. | [optional] +**currency** | **str** | SKU price currency. | [optional] +**product** | [**ProductWithoutSkus**](ProductWithoutSkus.md) | | [optional] + +[[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/ProductWithoutSkus.md b/docs/ProductWithoutSkus.md new file mode 100644 index 00000000..51fdae05 --- /dev/null +++ b/docs/ProductWithoutSkus.md @@ -0,0 +1,21 @@ +# ProductWithoutSkus + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID assigned by Voucherify. | [optional] +**source_id** | **str** | Unique product source ID. | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] + +[[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/ProductsApi.md b/docs/ProductsApi.md new file mode 100644 index 00000000..94e09385 --- /dev/null +++ b/docs/ProductsApi.md @@ -0,0 +1,1260 @@ +# voucherify.ProductsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_product**](ProductsApi.md#create_product) | **POST** /v1/products | Create Product +[**create_sku**](ProductsApi.md#create_sku) | **POST** /v1/products/{productId}/skus | Create SKU +[**delete_product**](ProductsApi.md#delete_product) | **DELETE** /v1/products/{productId} | Delete Product +[**delete_sku**](ProductsApi.md#delete_sku) | **DELETE** /v1/products/{productId}/skus/{skuId} | Delete SKU +[**get_product**](ProductsApi.md#get_product) | **GET** /v1/products/{productId} | Get Product +[**get_sku**](ProductsApi.md#get_sku) | **GET** /v1/skus/{skuId} | Get SKU +[**import_products_using_csv**](ProductsApi.md#import_products_using_csv) | **POST** /v1/products/importCSV | Import Products using CSV +[**import_skus_using_csv**](ProductsApi.md#import_skus_using_csv) | **POST** /v1/skus/importCSV | Import SKUs using CSV +[**list_products**](ProductsApi.md#list_products) | **GET** /v1/products | List Products +[**list_skus_in_product**](ProductsApi.md#list_skus_in_product) | **GET** /v1/products/{productId}/skus | List SKUs in Product +[**update_product**](ProductsApi.md#update_product) | **PUT** /v1/products/{productId} | Update Product +[**update_products_in_bulk**](ProductsApi.md#update_products_in_bulk) | **POST** /v1/products/bulk/async | Update Products in Bulk +[**update_products_metadata_in_bulk**](ProductsApi.md#update_products_metadata_in_bulk) | **POST** /v1/products/metadata/async | Update Products' Metadata in Bulk +[**update_sku**](ProductsApi.md#update_sku) | **PUT** /v1/products/{productId}/skus/{skuId} | Update SKU + + +# **create_product** +> ProductsCreateResponseBody create_product(products_create_request_body=products_create_request_body) + +Create Product + +Creates a product object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the product database, Voucherify will return a related product object with updated fields. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_create_request_body import ProductsCreateRequestBody +from voucherify.models.products_create_response_body import ProductsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + products_create_request_body = {"source_id":"first_product","name":"Samsung Phone","price":200000,"attributes":["color","memory","processor"],"metadata":{"test":true,"vendor":"Online Store"},"image_url":"https://www.website.com/image.png"} # ProductsCreateRequestBody | Specify the product parameters. (optional) + + try: + # Create Product + api_response = api_instance.create_product(products_create_request_body=products_create_request_body) + print("The response of ProductsApi->create_product:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->create_product: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **products_create_request_body** | [**ProductsCreateRequestBody**](ProductsCreateRequestBody.md)| Specify the product parameters. | [optional] + +### Return type + +[**ProductsCreateResponseBody**](ProductsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a product object if the operation succeeded. | - | + +[[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) + +# **create_sku** +> ProductsSkusCreateResponseBody create_sku(product_id, products_skus_create_request_body=products_skus_create_request_body) + +Create SKU + +This method adds product variants to a created product. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the sku database, Voucherify will return a related sku object with updated fields. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_skus_create_request_body import ProductsSkusCreateRequestBody +from voucherify.models.products_skus_create_response_body import ProductsSkusCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + product_id = 'product_id_example' # str | A Voucherify product ID or product source ID. + products_skus_create_request_body = {"source_id":"first_product_sku_1","sku":"Samsung phone 256GB","price":1300,"currency":"USD","attributes":{"color":"vintage-black","memory":"256","processor":"Intel"},"image_url":"https://www.website.com/image.png","metadata":{"imported":true}} # ProductsSkusCreateRequestBody | Specify the SKU parameters to be created. (optional) + + try: + # Create SKU + api_response = api_instance.create_sku(product_id, products_skus_create_request_body=products_skus_create_request_body) + print("The response of ProductsApi->create_sku:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->create_sku: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_id** | **str**| A Voucherify product ID or product source ID. | + **products_skus_create_request_body** | [**ProductsSkusCreateRequestBody**](ProductsSkusCreateRequestBody.md)| Specify the SKU parameters to be created. | [optional] + +### Return type + +[**ProductsSkusCreateResponseBody**](ProductsSkusCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the created SKU object. | - | + +[[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) + +# **delete_product** +> delete_product(product_id, force=force) + +Delete Product + +Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + product_id = 'product_id_example' # str | A Voucherify product ID or source ID. + force = True # bool | If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. (optional) + + try: + # Delete Product + api_instance.delete_product(product_id, force=force) + except Exception as e: + print("Exception when calling ProductsApi->delete_product: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_id** | **str**| A Voucherify product ID or source ID. | + **force** | **bool**| If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **delete_sku** +> delete_sku(product_id, sku_id, force=force) + +Delete SKU + +Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + product_id = 'product_id_example' # str | A unique Voucherify product ID or product source ID. + sku_id = 'sku_id_example' # str | A Voucherify SKU ID or SKU source ID. + force = True # bool | If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. (optional) + + try: + # Delete SKU + api_instance.delete_sku(product_id, sku_id, force=force) + except Exception as e: + print("Exception when calling ProductsApi->delete_sku: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_id** | **str**| A unique Voucherify product ID or product source ID. | + **sku_id** | **str**| A Voucherify SKU ID or SKU source ID. | + **force** | **bool**| If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **get_product** +> ProductsGetResponseBody get_product(product_id) + +Get Product + +Retrieve product details. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_get_response_body import ProductsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + product_id = 'product_id_example' # str | A Voucherify product ID or source ID. + + try: + # Get Product + api_response = api_instance.get_product(product_id) + print("The response of ProductsApi->get_product:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->get_product: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_id** | **str**| A Voucherify product ID or source ID. | + +### Return type + +[**ProductsGetResponseBody**](ProductsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a product object if a valid identifier was provided. | - | + +[[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) + +# **get_sku** +> SkusGetResponseBody get_sku(sku_id) + +Get SKU + +Retrieve details of a SKU. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.skus_get_response_body import SkusGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + sku_id = 'sku_id_example' # str | A Voucherify SKU identifier or SKU source ID. + + try: + # Get SKU + api_response = api_instance.get_sku(sku_id) + print("The response of ProductsApi->get_sku:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->get_sku: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sku_id** | **str**| A Voucherify SKU identifier or SKU source ID. | + +### Return type + +[**SkusGetResponseBody**](SkusGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns requested SKU object. | - | + +[[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) + +# **import_products_using_csv** +> ProductsImportCsvCreateResponseBody import_products_using_csv(file=file) + +Import Products using CSV + +Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_import_csv_create_response_body import ProductsImportCsvCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + file = None # bytearray | File path. (optional) + + try: + # Import Products using CSV + api_response = api_instance.import_products_using_csv(file=file) + print("The response of ProductsApi->import_products_using_csv:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->import_products_using_csv: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **bytearray**| File path. | [optional] + +### Return type + +[**ProductsImportCsvCreateResponseBody**](ProductsImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns ID of the scheduled async action. The response informs you that your request has been accepted and products will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **import_skus_using_csv** +> SkusImportCsvCreateResponseBody import_skus_using_csv(file=file) + +Import SKUs using CSV + +Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.skus_import_csv_create_response_body import SkusImportCsvCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + file = None # bytearray | File path. (optional) + + try: + # Import SKUs using CSV + api_response = api_instance.import_skus_using_csv(file=file) + print("The response of ProductsApi->import_skus_using_csv:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->import_skus_using_csv: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **bytearray**| File path. | [optional] + +### Return type + +[**SkusImportCsvCreateResponseBody**](SkusImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns ID of the scheduled async action. The response informs you that your request has been accepted and SKUs will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **list_products** +> ProductsListResponseBody list_products(limit=limit, page=page, order=order, start_date=start_date, end_date=end_date) + +List Products + +Retrieve a list of products. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.products_list_response_body import ProductsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrder() # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + start_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + end_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + + try: + # List Products + api_response = api_instance.list_products(limit=limit, page=page, order=order, start_date=start_date, end_date=end_date) + print("The response of ProductsApi->list_products:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->list_products: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrder**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **start_date** | **datetime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] + **end_date** | **datetime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] + +### Return type + +[**ProductsListResponseBody**](ProductsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with product objects. The products are returned sorted by creation date by default, with the most recent products appearing last, unless you specify another sequence using the `order` query parameter. | - | + +[[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) + +# **list_skus_in_product** +> ProductsSkusListResponseBody list_skus_in_product(product_id, limit=limit, page=page, order=order, start_date=start_date, end_date=end_date) + +List SKUs in Product + +Retrieve all SKUs for a given product. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.products_skus_list_response_body import ProductsSkusListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + product_id = 'product_id_example' # str | A Voucherify product ID or product source ID. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrder() # ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + start_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + end_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + + try: + # List SKUs in Product + api_response = api_instance.list_skus_in_product(product_id, limit=limit, page=page, order=order, start_date=start_date, end_date=end_date) + print("The response of ProductsApi->list_skus_in_product:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->list_skus_in_product: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_id** | **str**| A Voucherify product ID or product source ID. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrder**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **start_date** | **datetime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] + **end_date** | **datetime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] + +### Return type + +[**ProductsSkusListResponseBody**](ProductsSkusListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of SKUs. | - | + +[[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) + +# **update_product** +> ProductsUpdateResponseBody update_product(product_id, products_update_request_body=products_update_request_body) + +Update Product + +Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_update_request_body import ProductsUpdateRequestBody +from voucherify.models.products_update_response_body import ProductsUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + product_id = 'product_id_example' # str | A Voucherify product ID or source ID. + products_update_request_body = {"price":210000} # ProductsUpdateRequestBody | Specify the parameters of the product that are to be updated. (optional) + + try: + # Update Product + api_response = api_instance.update_product(product_id, products_update_request_body=products_update_request_body) + print("The response of ProductsApi->update_product:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->update_product: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_id** | **str**| A Voucherify product ID or source ID. | + **products_update_request_body** | [**ProductsUpdateRequestBody**](ProductsUpdateRequestBody.md)| Specify the parameters of the product that are to be updated. | [optional] + +### Return type + +[**ProductsUpdateResponseBody**](ProductsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an updated product object. | - | + +[[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) + +# **update_products_in_bulk** +> ProductsUpdateInBulkResponseBody update_products_in_bulk(products_update_in_bulk_request_body=products_update_in_bulk_request_body) + +Update Products in Bulk + +Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_update_in_bulk_request_body import ProductsUpdateInBulkRequestBody +from voucherify.models.products_update_in_bulk_response_body import ProductsUpdateInBulkResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + products_update_in_bulk_request_body = [{"source_id":"first_product","name":"Samsung Phone 1","price":220000,"attributes":["color","memory","processor"],"metadata":{"test":true,"vendor":"Online Store - 3"},"image_url":"https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png"},{"source_id":"second_product","name":"Samsung Phone 2","price":230000,"attributes":["color","memory","processor"],"metadata":{"test":true,"vendor":"Online Store - 4"},"image_url":"https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png"}] # List[ProductsUpdateInBulkRequestBody] | List the product fields to be updated in each customer object. (optional) + + try: + # Update Products in Bulk + api_response = api_instance.update_products_in_bulk(products_update_in_bulk_request_body=products_update_in_bulk_request_body) + print("The response of ProductsApi->update_products_in_bulk:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->update_products_in_bulk: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **products_update_in_bulk_request_body** | [**List[ProductsUpdateInBulkRequestBody]**](ProductsUpdateInBulkRequestBody.md)| List the product fields to be updated in each customer object. | [optional] + +### Return type + +[**ProductsUpdateInBulkResponseBody**](ProductsUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action. The response informs you that the request has been accepted and the resources will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and use it as a query parameter in the [GET Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **update_products_metadata_in_bulk** +> ProductsMetadataUpdateInBulkResponseBody update_products_metadata_in_bulk(products_metadata_update_in_bulk_request_body=products_metadata_update_in_bulk_request_body) + +Update Products' Metadata in Bulk + +Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_metadata_update_in_bulk_request_body import ProductsMetadataUpdateInBulkRequestBody +from voucherify.models.products_metadata_update_in_bulk_response_body import ProductsMetadataUpdateInBulkResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + products_metadata_update_in_bulk_request_body = {"source_ids":["123-567-3433","test_volleyball"],"metadata":{"label":true,"origin":"PL"}} # ProductsMetadataUpdateInBulkRequestBody | List the source_ids of the products you would like to update with the metadata key/value pairs. (optional) + + try: + # Update Products' Metadata in Bulk + api_response = api_instance.update_products_metadata_in_bulk(products_metadata_update_in_bulk_request_body=products_metadata_update_in_bulk_request_body) + print("The response of ProductsApi->update_products_metadata_in_bulk:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->update_products_metadata_in_bulk: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **products_metadata_update_in_bulk_request_body** | [**ProductsMetadataUpdateInBulkRequestBody**](ProductsMetadataUpdateInBulkRequestBody.md)| List the source_ids of the products you would like to update with the metadata key/value pairs. | [optional] + +### Return type + +[**ProductsMetadataUpdateInBulkResponseBody**](ProductsMetadataUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action. The response informs you that the request has been accepted and the resources will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and use it as a query parameter in the [GET Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **update_sku** +> ProductsSkusUpdateResponseBody update_sku(product_id, sku_id, products_skus_update_request_body=products_skus_update_request_body) + +Update SKU + +Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body schema wont be modified. Even if provided, they will be silently skipped. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.products_skus_update_request_body import ProductsSkusUpdateRequestBody +from voucherify.models.products_skus_update_response_body import ProductsSkusUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ProductsApi(api_client) + product_id = 'product_id_example' # str | A unique Voucherify product ID or product source ID. + sku_id = 'sku_id_example' # str | A Voucherify SKU ID or SKU source ID. + products_skus_update_request_body = {"price":210000,"currency":"PLN"} # ProductsSkusUpdateRequestBody | Specify the parameters to be updated. (optional) + + try: + # Update SKU + api_response = api_instance.update_sku(product_id, sku_id, products_skus_update_request_body=products_skus_update_request_body) + print("The response of ProductsApi->update_sku:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ProductsApi->update_sku: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **product_id** | **str**| A unique Voucherify product ID or product source ID. | + **sku_id** | **str**| A Voucherify SKU ID or SKU source ID. | + **products_skus_update_request_body** | [**ProductsSkusUpdateRequestBody**](ProductsSkusUpdateRequestBody.md)| Specify the parameters to be updated. | [optional] + +### Return type + +[**ProductsSkusUpdateResponseBody**](ProductsSkusUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the SKU object with the updated parameters. | - | + +[[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) + diff --git a/docs/ProductsCreateRequestBody.md b/docs/ProductsCreateRequestBody.md new file mode 100644 index 00000000..4a36ec08 --- /dev/null +++ b/docs/ProductsCreateRequestBody.md @@ -0,0 +1,19 @@ +# ProductsCreateRequestBody + +Request schema for **POST** `v1/products`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the product and is assigned by Voucherify. | [optional] +**source_id** | **str** | Unique product source ID. | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] + +[[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/ProductsCreateResponseBody.md b/docs/ProductsCreateResponseBody.md new file mode 100644 index 00000000..a8c2c705 --- /dev/null +++ b/docs/ProductsCreateResponseBody.md @@ -0,0 +1,23 @@ +# ProductsCreateResponseBody + +Response body schema for **POST** `v1/products`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID assigned by Voucherify. | [optional] +**source_id** | **str** | Unique product source ID. | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] + +[[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/ProductsGetResponseBody.md b/docs/ProductsGetResponseBody.md new file mode 100644 index 00000000..6174ce87 --- /dev/null +++ b/docs/ProductsGetResponseBody.md @@ -0,0 +1,23 @@ +# ProductsGetResponseBody + +Response body schema for **GET** `v1/products/{productId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID assigned by Voucherify. | [optional] +**source_id** | **str** | Unique product source ID. | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] + +[[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/ProductsImportCsvCreateResponseBody.md b/docs/ProductsImportCsvCreateResponseBody.md new file mode 100644 index 00000000..8d03dd41 --- /dev/null +++ b/docs/ProductsImportCsvCreateResponseBody.md @@ -0,0 +1,13 @@ +# ProductsImportCsvCreateResponseBody + +Response body schema for **POST** `v1/products/importCSV`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/ProductsListResponseBody.md b/docs/ProductsListResponseBody.md new file mode 100644 index 00000000..301b21fa --- /dev/null +++ b/docs/ProductsListResponseBody.md @@ -0,0 +1,16 @@ +# ProductsListResponseBody + +Response body schema for **GET** `v1/products`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about products in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of product objects. | [optional] [default to 'products'] +**products** | [**List[Product]**](Product.md) | Contains array of product objects. | [optional] +**total** | **int** | Total number of product objects. | [optional] + +[[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/ProductsMetadataUpdateInBulkRequestBody.md b/docs/ProductsMetadataUpdateInBulkRequestBody.md new file mode 100644 index 00000000..c22799a8 --- /dev/null +++ b/docs/ProductsMetadataUpdateInBulkRequestBody.md @@ -0,0 +1,14 @@ +# ProductsMetadataUpdateInBulkRequestBody + +Request schema for **POST** `v1/products/metadata/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_ids** | **List[str]** | Array of unique product source IDs. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] + +[[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/ProductsMetadataUpdateInBulkResponseBody.md b/docs/ProductsMetadataUpdateInBulkResponseBody.md new file mode 100644 index 00000000..80452b6a --- /dev/null +++ b/docs/ProductsMetadataUpdateInBulkResponseBody.md @@ -0,0 +1,13 @@ +# ProductsMetadataUpdateInBulkResponseBody + +Response body schema for **POST** `v1/products/metadata/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/ProductsSkusCreateRequestBody.md b/docs/ProductsSkusCreateRequestBody.md new file mode 100644 index 00000000..c0358a9b --- /dev/null +++ b/docs/ProductsSkusCreateRequestBody.md @@ -0,0 +1,20 @@ +# ProductsSkusCreateRequestBody + +Request body schema for **POST** `v1/products/{productId}/skus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique SKU ID. | [optional] +**source_id** | **str** | A unique SKU identifier from your inventory system. | [optional] +**sku** | **str** | Unique user-defined SKU name. | [optional] +**price** | **int** | SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**currency** | **str** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] + +[[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/ProductsSkusCreateResponseBody.md b/docs/ProductsSkusCreateResponseBody.md new file mode 100644 index 00000000..546ad1a3 --- /dev/null +++ b/docs/ProductsSkusCreateResponseBody.md @@ -0,0 +1,24 @@ +# ProductsSkusCreateResponseBody + +Response body schema for **PUT** `v1/products/{productId}/skus`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**source_id** | **str** | A unique SKU identifier from your inventory system. | [optional] +**product_id** | **str** | The parent product's unique ID. | [optional] +**sku** | **str** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **str** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[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/ProductsSkusListResponseBody.md b/docs/ProductsSkusListResponseBody.md new file mode 100644 index 00000000..ecfa5c57 --- /dev/null +++ b/docs/ProductsSkusListResponseBody.md @@ -0,0 +1,16 @@ +# ProductsSkusListResponseBody + +Response body schema for **GET** `v1/products/{productId}/skus`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about SKUs. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of SKUs. | [optional] [default to 'data'] +**skus** | [**List[Sku]**](Sku.md) | A dictionary that contains an array of SKUs. | [optional] +**total** | **int** | Total number of SKUs in the product. | [optional] + +[[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/ProductsSkusUpdateRequestBody.md b/docs/ProductsSkusUpdateRequestBody.md new file mode 100644 index 00000000..8a3d88e5 --- /dev/null +++ b/docs/ProductsSkusUpdateRequestBody.md @@ -0,0 +1,18 @@ +# ProductsSkusUpdateRequestBody + +Request body schema for **PUT** `v1/products/{productId}/skus/{skuId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sku** | **str** | Unique user-defined SKU name. | [optional] +**price** | **int** | SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] +**currency** | **str** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] + +[[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/ProductsSkusUpdateResponseBody.md b/docs/ProductsSkusUpdateResponseBody.md new file mode 100644 index 00000000..5d353466 --- /dev/null +++ b/docs/ProductsSkusUpdateResponseBody.md @@ -0,0 +1,24 @@ +# ProductsSkusUpdateResponseBody + +Response body schema for **PUT** `v1/products/{productId}/skus/{skuId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**source_id** | **str** | A unique SKU identifier from your inventory system. | [optional] +**product_id** | **str** | The parent product's unique ID. | [optional] +**sku** | **str** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **str** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[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/ProductsUpdateInBulkRequestBody.md b/docs/ProductsUpdateInBulkRequestBody.md new file mode 100644 index 00000000..61dd8fb7 --- /dev/null +++ b/docs/ProductsUpdateInBulkRequestBody.md @@ -0,0 +1,18 @@ +# ProductsUpdateInBulkRequestBody + +Request schema for **POST** `v1/products/bulk/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_id** | **str** | Unique product source ID from your inventory system. | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] + +[[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/ProductsUpdateInBulkResponseBody.md b/docs/ProductsUpdateInBulkResponseBody.md new file mode 100644 index 00000000..e16eddc4 --- /dev/null +++ b/docs/ProductsUpdateInBulkResponseBody.md @@ -0,0 +1,13 @@ +# ProductsUpdateInBulkResponseBody + +Response body schema for **POST** `v1/products/bulk/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/ProductsUpdateRequestBody.md b/docs/ProductsUpdateRequestBody.md new file mode 100644 index 00000000..04f5cc3a --- /dev/null +++ b/docs/ProductsUpdateRequestBody.md @@ -0,0 +1,17 @@ +# ProductsUpdateRequestBody + +Request schema for **PUT** `v1/products`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] + +[[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/ProductsUpdateResponseBody.md b/docs/ProductsUpdateResponseBody.md new file mode 100644 index 00000000..d2c4be79 --- /dev/null +++ b/docs/ProductsUpdateResponseBody.md @@ -0,0 +1,23 @@ +# ProductsUpdateResponseBody + +Response body schema for **PUT** `v1/products/{productId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID assigned by Voucherify. | [optional] +**source_id** | **str** | Unique product source ID. | [optional] +**name** | **str** | Unique user-defined product name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**attributes** | **List[str]** | A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the product. | [optional] [default to 'product'] +**skus** | [**SkusListForProduct**](SkusListForProduct.md) | | [optional] + +[[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/PromotionStack.md b/docs/PromotionStack.md new file mode 100644 index 00000000..17d5c6de --- /dev/null +++ b/docs/PromotionStack.md @@ -0,0 +1,20 @@ +# PromotionStack + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Promotion stack name. | [optional] +**tiers** | [**PromotionStackTiers**](PromotionStackTiers.md) | | [optional] +**id** | **str** | Unique promotion stack ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] +**campaign_id** | **str** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**category_id** | **str** | Promotion stack category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | Details about the category assigned to the promotion stack. | [optional] + +[[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/PromotionStackBase.md b/docs/PromotionStackBase.md new file mode 100644 index 00000000..0edac865 --- /dev/null +++ b/docs/PromotionStackBase.md @@ -0,0 +1,13 @@ +# PromotionStackBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Promotion stack name. | [optional] +**tiers** | [**PromotionStackBaseTiers**](PromotionStackBaseTiers.md) | | [optional] + +[[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/PromotionStackBaseTiers.md b/docs/PromotionStackBaseTiers.md new file mode 100644 index 00000000..b8351ec8 --- /dev/null +++ b/docs/PromotionStackBaseTiers.md @@ -0,0 +1,14 @@ +# PromotionStackBaseTiers + +Contains the tier configuration. A promotion stack can include up to 30 tiers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List[str]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchy_mode** | **str** | | [optional] [default to 'MANUAL'] + +[[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/PromotionStackTiers.md b/docs/PromotionStackTiers.md new file mode 100644 index 00000000..89da0a4d --- /dev/null +++ b/docs/PromotionStackTiers.md @@ -0,0 +1,14 @@ +# PromotionStackTiers + +Contains the tier configuration. A promotion stack can include up to 30 tiers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List[str]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchy_mode** | **str** | | [optional] [default to 'MANUAL'] + +[[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/PromotionTier.md b/docs/PromotionTier.md new file mode 100644 index 00000000..5a1255c2 --- /dev/null +++ b/docs/PromotionTier.md @@ -0,0 +1,34 @@ +# PromotionTier + +This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionTierAction**](PromotionTierAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**PromotionTierCampaign**](PromotionTierCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**PromotionTierSummary**](PromotionTierSummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/PromotionTierAction.md b/docs/PromotionTierAction.md new file mode 100644 index 00000000..dfc93803 --- /dev/null +++ b/docs/PromotionTierAction.md @@ -0,0 +1,13 @@ +# PromotionTierAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionTierCampaign.md b/docs/PromotionTierCampaign.md new file mode 100644 index 00000000..8bb52b3b --- /dev/null +++ b/docs/PromotionTierCampaign.md @@ -0,0 +1,21 @@ +# PromotionTierCampaign + +Contains details about promotion tier's parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/PromotionTierCreateParams.md b/docs/PromotionTierCreateParams.md new file mode 100644 index 00000000..8e92b2c7 --- /dev/null +++ b/docs/PromotionTierCreateParams.md @@ -0,0 +1,26 @@ +# PromotionTierCreateParams + +This is an object representing a promotion tier create params. Promotion tiers are always assigned to a campaign and cannot be used standalone. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionTierCreateParamsAction**](PromotionTierCreateParamsAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**validation_rules** | **List[str]** | Array containing the ID of the validation rule associated with the promotion tier. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**category** | **str** | Assign category to the promotion tier. | [optional] +**category_id** | **str** | Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`. | [optional] + +[[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/PromotionTierCreateParamsAction.md b/docs/PromotionTierCreateParamsAction.md new file mode 100644 index 00000000..0e79e608 --- /dev/null +++ b/docs/PromotionTierCreateParamsAction.md @@ -0,0 +1,13 @@ +# PromotionTierCreateParamsAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionTierSummary.md b/docs/PromotionTierSummary.md new file mode 100644 index 00000000..ddb0357c --- /dev/null +++ b/docs/PromotionTierSummary.md @@ -0,0 +1,14 @@ +# PromotionTierSummary + +Contains statistics about promotion tier redemptions and orders. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**PromotionTierSummaryRedemptions**](PromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**PromotionTierSummaryOrders**](PromotionTierSummaryOrders.md) | | [optional] + +[[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/PromotionTierSummaryOrders.md b/docs/PromotionTierSummaryOrders.md new file mode 100644 index 00000000..e385e7b9 --- /dev/null +++ b/docs/PromotionTierSummaryOrders.md @@ -0,0 +1,14 @@ +# PromotionTierSummaryOrders + +Contains statistics about orders related to the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/PromotionTierSummaryRedemptions.md b/docs/PromotionTierSummaryRedemptions.md new file mode 100644 index 00000000..b0b5a91c --- /dev/null +++ b/docs/PromotionTierSummaryRedemptions.md @@ -0,0 +1,13 @@ +# PromotionTierSummaryRedemptions + +Contains statistics about promotion tier redemptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/PromotionTiersList.md b/docs/PromotionTiersList.md new file mode 100644 index 00000000..7648fa76 --- /dev/null +++ b/docs/PromotionTiersList.md @@ -0,0 +1,17 @@ +# PromotionTiersList + +Promotion Tiers + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional] [default to 'tiers'] +**tiers** | [**List[PromotionTier]**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] +**total** | **int** | Total number of promotion tiers. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results. | [optional] + +[[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/PromotionsApi.md b/docs/PromotionsApi.md new file mode 100644 index 00000000..db1965d8 --- /dev/null +++ b/docs/PromotionsApi.md @@ -0,0 +1,1256 @@ +# voucherify.PromotionsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_promotion_tier_to_campaign**](PromotionsApi.md#add_promotion_tier_to_campaign) | **POST** /v1/promotions/{campaignId}/tiers | Add Promotion Tier to Campaign +[**create_promotion_stack**](PromotionsApi.md#create_promotion_stack) | **POST** /v1/promotions/{campaignId}/stacks | Create Promotion Stack +[**delete_promotion_stack**](PromotionsApi.md#delete_promotion_stack) | **DELETE** /v1/promotions/{campaignId}/stacks/{stackId} | Delete Promotion Stack +[**delete_promotion_tier**](PromotionsApi.md#delete_promotion_tier) | **DELETE** /v1/promotions/tiers/{promotionTierId} | Delete Promotion Tier +[**disable_promotion_tier**](PromotionsApi.md#disable_promotion_tier) | **POST** /v1/promotions/tiers/{promotionTierId}/disable | Disable Promotion Tier +[**enable_promotion_tier**](PromotionsApi.md#enable_promotion_tier) | **POST** /v1/promotions/tiers/{promotionTierId}/enable | Enable Promotion Tier +[**get_promotion_stack**](PromotionsApi.md#get_promotion_stack) | **GET** /v1/promotions/{campaignId}/stacks/{stackId} | Get Promotion Stack +[**get_promotion_tier**](PromotionsApi.md#get_promotion_tier) | **GET** /v1/promotions/tiers/{promotionTierId} | Get Promotion Tier +[**list_all_promotion_stacks**](PromotionsApi.md#list_all_promotion_stacks) | **GET** /v1/promotions/stacks | List Promotion Stacks +[**list_promotion_stacks_in_campaign**](PromotionsApi.md#list_promotion_stacks_in_campaign) | **GET** /v1/promotions/{campaignId}/stacks | List Promotion Stacks in Campaign +[**list_promotion_tiers**](PromotionsApi.md#list_promotion_tiers) | **GET** /v1/promotions/tiers | List Promotion Tiers +[**list_promotion_tiers_from_campaign**](PromotionsApi.md#list_promotion_tiers_from_campaign) | **GET** /v1/promotions/{campaignId}/tiers | List Promotion Tiers from Campaign +[**update_promotion_stack**](PromotionsApi.md#update_promotion_stack) | **PUT** /v1/promotions/{campaignId}/stacks/{stackId} | Update Promotion Stack +[**update_promotion_tier**](PromotionsApi.md#update_promotion_tier) | **PUT** /v1/promotions/tiers/{promotionTierId} | Update Promotion Tier + + +# **add_promotion_tier_to_campaign** +> PromotionsTiersCreateResponseBody add_promotion_tier_to_campaign(campaign_id, promotions_tiers_create_request_body=promotions_tiers_create_request_body) + +Add Promotion Tier to Campaign + +This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_tiers_create_request_body import PromotionsTiersCreateRequestBody +from voucherify.models.promotions_tiers_create_response_body import PromotionsTiersCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID assigned by Voucherify. + promotions_tiers_create_request_body = {"name":"Order more than $100","banner":"Order more than $100","action":{"discount":{"type":"AMOUNT","amount_off":3000,"effect":"APPLY_TO_ORDER"}},"metadata":{},"active":true,"start_date":"2022-09-21T00:00:00.000Z","expiration_date":"2022-09-30T00:00:00.000Z","validity_timeframe":{"interval":"P2D","duration":"P1D"},"validity_day_of_week":[1,2,3,4],"validation_rules":["val_q8qUBMOh5qIQ"]} # PromotionsTiersCreateRequestBody | Specify the promotion tier parameters. (optional) + + try: + # Add Promotion Tier to Campaign + api_response = api_instance.add_promotion_tier_to_campaign(campaign_id, promotions_tiers_create_request_body=promotions_tiers_create_request_body) + print("The response of PromotionsApi->add_promotion_tier_to_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->add_promotion_tier_to_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID assigned by Voucherify. | + **promotions_tiers_create_request_body** | [**PromotionsTiersCreateRequestBody**](PromotionsTiersCreateRequestBody.md)| Specify the promotion tier parameters. | [optional] + +### Return type + +[**PromotionsTiersCreateResponseBody**](PromotionsTiersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a promotion tier object if the promotion tier was successfully added to the campaign. | - | + +[[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) + +# **create_promotion_stack** +> PromotionsStacksCreateResponseBody create_promotion_stack(campaign_id, promotions_stacks_create_request_body=promotions_stacks_create_request_body) + +Create Promotion Stack + +This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_stacks_create_request_body import PromotionsStacksCreateRequestBody +from voucherify.models.promotions_stacks_create_response_body import PromotionsStacksCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID. + promotions_stacks_create_request_body = {"name":"Fifth Stack","tiers":{"ids":["promo_aaAF8mVAzA0PF1igia2OC63d","promo_t9zdL6XMFk7B8fQ23zxELtdE","promo_dJNhAEeV5sR5oPQq1UrUdnMC"],"hierarchy_mode":"MANUAL"}} # PromotionsStacksCreateRequestBody | Specify the order of promotion tiers for the promotion stack. (optional) + + try: + # Create Promotion Stack + api_response = api_instance.create_promotion_stack(campaign_id, promotions_stacks_create_request_body=promotions_stacks_create_request_body) + print("The response of PromotionsApi->create_promotion_stack:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->create_promotion_stack: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID. | + **promotions_stacks_create_request_body** | [**PromotionsStacksCreateRequestBody**](PromotionsStacksCreateRequestBody.md)| Specify the order of promotion tiers for the promotion stack. | [optional] + +### Return type + +[**PromotionsStacksCreateResponseBody**](PromotionsStacksCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a new stack object if a valid promotion campaign identifier was provided in the path and available promotion IDs in the payload. | - | + +[[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) + +# **delete_promotion_stack** +> delete_promotion_stack(campaign_id, stack_id) + +Delete Promotion Stack + +This method deletes a promotion stack. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + campaign_id = 'campaign_id_example' # str | ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. + stack_id = 'stack_id_example' # str | Promotion stack ID. + + try: + # Delete Promotion Stack + api_instance.delete_promotion_stack(campaign_id, stack_id) + except Exception as e: + print("Exception when calling PromotionsApi->delete_promotion_stack: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. | + **stack_id** | **str**| Promotion stack ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **delete_promotion_tier** +> delete_promotion_tier(promotion_tier_id) + +Delete Promotion Tier + +This method deletes a promotion tier. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + promotion_tier_id = 'promotion_tier_id_example' # str | Unique promotion tier ID. + + try: + # Delete Promotion Tier + api_instance.delete_promotion_tier(promotion_tier_id) + except Exception as e: + print("Exception when calling PromotionsApi->delete_promotion_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **promotion_tier_id** | **str**| Unique promotion tier ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **disable_promotion_tier** +> PromotionsTiersDisableResponseBody disable_promotion_tier(promotion_tier_id) + +Disable Promotion Tier + +This method disables a promotion tier, i.e. makes the active parameter false. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_tiers_disable_response_body import PromotionsTiersDisableResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + promotion_tier_id = 'promotion_tier_id_example' # str | Unique promotion tier ID. + + try: + # Disable Promotion Tier + api_response = api_instance.disable_promotion_tier(promotion_tier_id) + print("The response of PromotionsApi->disable_promotion_tier:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->disable_promotion_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **promotion_tier_id** | **str**| Unique promotion tier ID. | + +### Return type + +[**PromotionsTiersDisableResponseBody**](PromotionsTiersDisableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the promotion tier object with an updated `active` parameter. | - | + +[[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) + +# **enable_promotion_tier** +> PromotionsTiersEnableResponseBody enable_promotion_tier(promotion_tier_id) + +Enable Promotion Tier + +This method enables a promotion tier, i.e. makes the active parameter true. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_tiers_enable_response_body import PromotionsTiersEnableResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + promotion_tier_id = 'promotion_tier_id_example' # str | Unique promotion tier ID. + + try: + # Enable Promotion Tier + api_response = api_instance.enable_promotion_tier(promotion_tier_id) + print("The response of PromotionsApi->enable_promotion_tier:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->enable_promotion_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **promotion_tier_id** | **str**| Unique promotion tier ID. | + +### Return type + +[**PromotionsTiersEnableResponseBody**](PromotionsTiersEnableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the promotion tier object with an updated `active` parameter. | - | + +[[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) + +# **get_promotion_stack** +> PromotionsStacksGetResponseBody get_promotion_stack(campaign_id, stack_id) + +Get Promotion Stack + +This method returns the details of a promotion stack, including the promotion tiers grouped within the stack. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_stacks_get_response_body import PromotionsStacksGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + campaign_id = 'campaign_id_example' # str | ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. + stack_id = 'stack_id_example' # str | Promotion stack ID. + + try: + # Get Promotion Stack + api_response = api_instance.get_promotion_stack(campaign_id, stack_id) + print("The response of PromotionsApi->get_promotion_stack:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->get_promotion_stack: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. | + **stack_id** | **str**| Promotion stack ID. | + +### Return type + +[**PromotionsStacksGetResponseBody**](PromotionsStacksGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a stack object if valid identifiers were provided in the path. | - | + +[[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) + +# **get_promotion_tier** +> PromotionsTiersGetResponseBody get_promotion_tier(promotion_tier_id) + +Get Promotion Tier + +This method enables you to retrieve a specific promotion tier. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_tiers_get_response_body import PromotionsTiersGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + promotion_tier_id = 'promotion_tier_id_example' # str | Unique promotion tier ID. + + try: + # Get Promotion Tier + api_response = api_instance.get_promotion_tier(promotion_tier_id) + print("The response of PromotionsApi->get_promotion_tier:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->get_promotion_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **promotion_tier_id** | **str**| Unique promotion tier ID. | + +### Return type + +[**PromotionsTiersGetResponseBody**](PromotionsTiersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a promotion tier object. | - | + +[[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) + +# **list_all_promotion_stacks** +> PromotionsStacksListResponseBody list_all_promotion_stacks(limit=limit, page=page, order=order, created_at=created_at, updated_at=updated_at) + +List Promotion Stacks + +This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_order_list_all_promotion_stacks import ParameterOrderListAllPromotionStacks +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter +from voucherify.models.promotions_stacks_list_response_body import PromotionsStacksListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListAllPromotionStacks() # ParameterOrderListAllPromotionStacks | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + created_at = voucherify.ParameterCreatedBeforeAfter() # ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + updated_at = voucherify.ParameterUpdatedBeforeAfter() # ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + + try: + # List Promotion Stacks + api_response = api_instance.list_all_promotion_stacks(limit=limit, page=page, order=order, created_at=created_at, updated_at=updated_at) + print("The response of PromotionsApi->list_all_promotion_stacks:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->list_all_promotion_stacks: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListAllPromotionStacks**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **created_at** | [**ParameterCreatedBeforeAfter**](.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] + **updated_at** | [**ParameterUpdatedBeforeAfter**](.md)| A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] + +### Return type + +[**PromotionsStacksListResponseBody**](PromotionsStacksListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with a `data` property that contains an array of promotion stacks across all your campaigns. | - | + +[[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) + +# **list_promotion_stacks_in_campaign** +> PromotionsStacksListResponseBody list_promotion_stacks_in_campaign(campaign_id) + +List Promotion Stacks in Campaign + +This method enables you to list promotion stacks from a specified campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_stacks_list_response_body import PromotionsStacksListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID. + + try: + # List Promotion Stacks in Campaign + api_response = api_instance.list_promotion_stacks_in_campaign(campaign_id) + print("The response of PromotionsApi->list_promotion_stacks_in_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->list_promotion_stacks_in_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID. | + +### Return type + +[**PromotionsStacksListResponseBody**](PromotionsStacksListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of promotion stack objects. | - | + +[[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) + +# **list_promotion_tiers** +> PromotionsTiersListResponseBody list_promotion_tiers(is_available=is_available, limit=limit, page=page, order=order) + +List Promotion Tiers + +This method enables you to list promotion tiers. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order_list_promotion_tiers import ParameterOrderListPromotionTiers +from voucherify.models.promotions_tiers_list_response_body import PromotionsTiersListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + is_available = True # bool | This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. (optional) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListPromotionTiers() # ParameterOrderListPromotionTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Promotion Tiers + api_response = api_instance.list_promotion_tiers(is_available=is_available, limit=limit, page=page, order=order) + print("The response of PromotionsApi->list_promotion_tiers:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->list_promotion_tiers: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **is_available** | **bool**| This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. | [optional] + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListPromotionTiers**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**PromotionsTiersListResponseBody**](PromotionsTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with a `tiers` property that contains an array of promotion tiers. | - | + +[[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) + +# **list_promotion_tiers_from_campaign** +> PromotionsTiersListResponseBody list_promotion_tiers_from_campaign(campaign_id) + +List Promotion Tiers from Campaign + +This method enables you to list promotion tiers from a specified campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_tiers_list_response_body import PromotionsTiersListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + campaign_id = 'campaign_id_example' # str | Unique campaign ID assigned by Voucherify. + + try: + # List Promotion Tiers from Campaign + api_response = api_instance.list_promotion_tiers_from_campaign(campaign_id) + print("The response of PromotionsApi->list_promotion_tiers_from_campaign:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->list_promotion_tiers_from_campaign: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| Unique campaign ID assigned by Voucherify. | + +### Return type + +[**PromotionsTiersListResponseBody**](PromotionsTiersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with a `tiers` property that contains an array of promotion tiers. | - | + +[[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) + +# **update_promotion_stack** +> PromotionsStacksUpdateResponseBody update_promotion_stack(campaign_id, stack_id, promotions_stacks_update_request_body=promotions_stacks_update_request_body) + +Update Promotion Stack + +This methods allows for editing an existing stack. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_stacks_update_request_body import PromotionsStacksUpdateRequestBody +from voucherify.models.promotions_stacks_update_response_body import PromotionsStacksUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + campaign_id = 'campaign_id_example' # str | ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. + stack_id = 'stack_id_example' # str | Promotion stack ID. + promotions_stacks_update_request_body = {"name":"Fifth Stack Modified","tiers":{"ids":["promo_aaAF8mVAzA0PF1igia2OC63d","promo_t9zdL6XMFk7B8fQ23zxELtdE"],"hierarchy_mode":"MANUAL"}} # PromotionsStacksUpdateRequestBody | Specify the promotion stack parameters that you would like to update. (optional) + + try: + # Update Promotion Stack + api_response = api_instance.update_promotion_stack(campaign_id, stack_id, promotions_stacks_update_request_body=promotions_stacks_update_request_body) + print("The response of PromotionsApi->update_promotion_stack:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->update_promotion_stack: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **campaign_id** | **str**| ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. | + **stack_id** | **str**| Promotion stack ID. | + **promotions_stacks_update_request_body** | [**PromotionsStacksUpdateRequestBody**](PromotionsStacksUpdateRequestBody.md)| Specify the promotion stack parameters that you would like to update. | [optional] + +### Return type + +[**PromotionsStacksUpdateResponseBody**](PromotionsStacksUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a promotion stack with updated parameters if the update was successful. | - | + +[[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) + +# **update_promotion_tier** +> PromotionsTiersUpdateResponseBody update_promotion_tier(promotion_tier_id, promotions_tiers_update_request_body=promotions_tiers_update_request_body) + +Update Promotion Tier + +This method updates a promotion tier. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.promotions_tiers_update_request_body import PromotionsTiersUpdateRequestBody +from voucherify.models.promotions_tiers_update_response_body import PromotionsTiersUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PromotionsApi(api_client) + promotion_tier_id = 'promotion_tier_id_example' # str | Unique promotion tier ID. + promotions_tiers_update_request_body = {"name":"Order more than $100 USD","banner":"Order more than $100 USD","action":{"discount":{"type":"PERCENT","percent_off":25,"effect":"APPLY_TO_ORDER"}},"metadata":{"level":"A-21"},"hierarchy":1,"start_date":"2022-09-22T00:00:00.000Z","expiration_date":"2022-09-29T00:00:00.000Z","validity_timeframe":{"interval":"P3D","duration":"P2D"},"validity_day_of_week":[1,2,3]} # PromotionsTiersUpdateRequestBody | Specify the promotion tier parameters that you would like to update. (optional) + + try: + # Update Promotion Tier + api_response = api_instance.update_promotion_tier(promotion_tier_id, promotions_tiers_update_request_body=promotions_tiers_update_request_body) + print("The response of PromotionsApi->update_promotion_tier:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PromotionsApi->update_promotion_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **promotion_tier_id** | **str**| Unique promotion tier ID. | + **promotions_tiers_update_request_body** | [**PromotionsTiersUpdateRequestBody**](PromotionsTiersUpdateRequestBody.md)| Specify the promotion tier parameters that you would like to update. | [optional] + +### Return type + +[**PromotionsTiersUpdateResponseBody**](PromotionsTiersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a promotion tier object if the update was successful. | - | + +[[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) + diff --git a/docs/PromotionsStacksCreateRequestBody.md b/docs/PromotionsStacksCreateRequestBody.md new file mode 100644 index 00000000..237faae0 --- /dev/null +++ b/docs/PromotionsStacksCreateRequestBody.md @@ -0,0 +1,15 @@ +# PromotionsStacksCreateRequestBody + +Request body schema for **POST** `v1/promotions/{campaignId}/stacks`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Promotion stack name. | [optional] +**tiers** | [**PromotionsStacksCreateRequestBodyTiers**](PromotionsStacksCreateRequestBodyTiers.md) | | [optional] +**category_id** | **str** | Promotion stack category ID. | [optional] + +[[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/PromotionsStacksCreateRequestBodyTiers.md b/docs/PromotionsStacksCreateRequestBodyTiers.md new file mode 100644 index 00000000..e6dbb3ce --- /dev/null +++ b/docs/PromotionsStacksCreateRequestBodyTiers.md @@ -0,0 +1,14 @@ +# PromotionsStacksCreateRequestBodyTiers + +Contains the tier configuration. A promotion stack can include up to 30 tiers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List[str]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchy_mode** | **str** | | [optional] [default to 'MANUAL'] + +[[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/PromotionsStacksCreateResponseBody.md b/docs/PromotionsStacksCreateResponseBody.md new file mode 100644 index 00000000..41a62637 --- /dev/null +++ b/docs/PromotionsStacksCreateResponseBody.md @@ -0,0 +1,20 @@ +# PromotionsStacksCreateResponseBody + +Response body schema for **POST** `v1/promotions/{campaignId}/stacks`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Promotion stack name. | [optional] +**tiers** | [**PromotionsStacksCreateResponseBodyTiers**](PromotionsStacksCreateResponseBodyTiers.md) | | [optional] +**id** | **str** | Unique promotion stack ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**campaign_id** | **str** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**category_id** | **str** | Promotion stack category ID. | [optional] +**categories** | [**List[PromotionStackBase]**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | [optional] + +[[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/PromotionsStacksCreateResponseBodyTiers.md b/docs/PromotionsStacksCreateResponseBodyTiers.md new file mode 100644 index 00000000..36899951 --- /dev/null +++ b/docs/PromotionsStacksCreateResponseBodyTiers.md @@ -0,0 +1,14 @@ +# PromotionsStacksCreateResponseBodyTiers + +Contains the tier configuration. A promotion stack can include up to 30 tiers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List[str]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchy_mode** | **str** | | [optional] [default to 'MANUAL'] + +[[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/PromotionsStacksGetResponseBody.md b/docs/PromotionsStacksGetResponseBody.md new file mode 100644 index 00000000..e9670f64 --- /dev/null +++ b/docs/PromotionsStacksGetResponseBody.md @@ -0,0 +1,21 @@ +# PromotionsStacksGetResponseBody + +Response body schema for **GET** `v1/promotions/{campaignId}/stacks/{stackId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Promotion stack name. | [optional] +**tiers** | [**PromotionsStacksGetResponseBodyTiers**](PromotionsStacksGetResponseBodyTiers.md) | | [optional] +**id** | **str** | Unique promotion stack ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] +**campaign_id** | **str** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**category_id** | **str** | Promotion stack category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | Details about the category assigned to the promotion stack. | [optional] + +[[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/PromotionsStacksGetResponseBodyTiers.md b/docs/PromotionsStacksGetResponseBodyTiers.md new file mode 100644 index 00000000..9efaf573 --- /dev/null +++ b/docs/PromotionsStacksGetResponseBodyTiers.md @@ -0,0 +1,14 @@ +# PromotionsStacksGetResponseBodyTiers + +Contains the tier configuration. A promotion stack can include up to 30 tiers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List[str]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchy_mode** | **str** | | [optional] [default to 'MANUAL'] + +[[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/PromotionsStacksListResponseBody.md b/docs/PromotionsStacksListResponseBody.md new file mode 100644 index 00000000..e5391274 --- /dev/null +++ b/docs/PromotionsStacksListResponseBody.md @@ -0,0 +1,16 @@ +# PromotionsStacksListResponseBody + +Response body schema for **GET** `v1/promotions/stacks` and for **GET** `v1/promotions/{campaignId}/stacks`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about promotion stacks in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of promotion stack objects. | [optional] [default to 'data'] +**data** | [**List[PromotionStack]**](PromotionStack.md) | Contains array of promotion stack objects. | [optional] +**total** | **int** | Total number of promotion stacks. | [optional] + +[[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/PromotionsStacksUpdateRequestBody.md b/docs/PromotionsStacksUpdateRequestBody.md new file mode 100644 index 00000000..2796ee05 --- /dev/null +++ b/docs/PromotionsStacksUpdateRequestBody.md @@ -0,0 +1,15 @@ +# PromotionsStacksUpdateRequestBody + +Request Body schema for **PUT** `v1/promotions/{campaignId}/stacks/{stackId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Promotion stack name. | [optional] +**tiers** | [**PromotionsStacksUpdateRequestBodyTiers**](PromotionsStacksUpdateRequestBodyTiers.md) | | [optional] +**category_id** | **str** | Promotion stack category ID. | [optional] + +[[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/PromotionsStacksUpdateRequestBodyTiers.md b/docs/PromotionsStacksUpdateRequestBodyTiers.md new file mode 100644 index 00000000..0ae3005e --- /dev/null +++ b/docs/PromotionsStacksUpdateRequestBodyTiers.md @@ -0,0 +1,14 @@ +# PromotionsStacksUpdateRequestBodyTiers + +Contains the tier configuration. A promotion stack can include up to 30 tiers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List[str]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchy_mode** | **str** | Category hierarchy. | [optional] [default to 'MANUAL'] + +[[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/PromotionsStacksUpdateResponseBody.md b/docs/PromotionsStacksUpdateResponseBody.md new file mode 100644 index 00000000..14c657e8 --- /dev/null +++ b/docs/PromotionsStacksUpdateResponseBody.md @@ -0,0 +1,21 @@ +# PromotionsStacksUpdateResponseBody + +Response body schema for **PUT** `v1/promotions/{campaignId}/stacks/{stackId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Promotion stack name. | [optional] +**tiers** | [**PromotionsStacksUpdateResponseBodyTiers**](PromotionsStacksUpdateResponseBodyTiers.md) | | [optional] +**id** | **str** | Unique promotion stack ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format. | [optional] +**campaign_id** | **str** | Promotion stack's parent campaign's unique ID. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'promotion_stack'] +**category_id** | **str** | Promotion stack category ID. | [optional] +**categories** | [**List[PromotionStackBase]**](PromotionStackBase.md) | Details about the category assigned to the promotion stack. | [optional] + +[[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/PromotionsStacksUpdateResponseBodyTiers.md b/docs/PromotionsStacksUpdateResponseBodyTiers.md new file mode 100644 index 00000000..4822158f --- /dev/null +++ b/docs/PromotionsStacksUpdateResponseBodyTiers.md @@ -0,0 +1,14 @@ +# PromotionsStacksUpdateResponseBodyTiers + +Contains the tier configuration. A promotion stack can include up to 30 tiers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List[str]** | Contains the list of tiers in a pre-defined sequence. | [optional] +**hierarchy_mode** | **str** | | [optional] [default to 'MANUAL'] + +[[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/PromotionsTiersCreateRequestBody.md b/docs/PromotionsTiersCreateRequestBody.md new file mode 100644 index 00000000..3d00378b --- /dev/null +++ b/docs/PromotionsTiersCreateRequestBody.md @@ -0,0 +1,26 @@ +# PromotionsTiersCreateRequestBody + +Request body schema for **POST** `v1/v1/promotions/{campaignId}/tiers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionsTiersCreateRequestBodyAction**](PromotionsTiersCreateRequestBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category** | **str** | Assign a new or update the promotion tier's category using name. | [optional] +**category_id** | **str** | Assign a new or update the promotion tier's category using id | [optional] + +[[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/PromotionsTiersCreateRequestBodyAction.md b/docs/PromotionsTiersCreateRequestBodyAction.md new file mode 100644 index 00000000..d01560f3 --- /dev/null +++ b/docs/PromotionsTiersCreateRequestBodyAction.md @@ -0,0 +1,13 @@ +# PromotionsTiersCreateRequestBodyAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionsTiersCreateResponseBody.md b/docs/PromotionsTiersCreateResponseBody.md new file mode 100644 index 00000000..718dec58 --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBody.md @@ -0,0 +1,34 @@ +# PromotionsTiersCreateResponseBody + +Response body schema for **POST** `v1/promotions/{campaignId}/tiers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionsTiersCreateResponseBodyAction**](PromotionsTiersCreateResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**PromotionsTiersCreateResponseBodyCampaign**](PromotionsTiersCreateResponseBodyCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**PromotionsTiersCreateResponseBodySummary**](PromotionsTiersCreateResponseBodySummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/PromotionsTiersCreateResponseBodyAction.md b/docs/PromotionsTiersCreateResponseBodyAction.md new file mode 100644 index 00000000..7ccfc052 --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodyAction.md @@ -0,0 +1,13 @@ +# PromotionsTiersCreateResponseBodyAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionsTiersCreateResponseBodyCampaign.md b/docs/PromotionsTiersCreateResponseBodyCampaign.md new file mode 100644 index 00000000..78ffb45e --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodyCampaign.md @@ -0,0 +1,21 @@ +# PromotionsTiersCreateResponseBodyCampaign + +Contains details about promotion tier's parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/PromotionsTiersCreateResponseBodySummary.md b/docs/PromotionsTiersCreateResponseBodySummary.md new file mode 100644 index 00000000..ac281220 --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodySummary.md @@ -0,0 +1,14 @@ +# PromotionsTiersCreateResponseBodySummary + +Contains statistics about promotion tier redemptions and orders. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**PromotionsTiersCreateResponseBodySummaryRedemptions**](PromotionsTiersCreateResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**PromotionsTiersCreateResponseBodySummaryOrders**](PromotionsTiersCreateResponseBodySummaryOrders.md) | | [optional] + +[[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/PromotionsTiersCreateResponseBodySummaryOrders.md b/docs/PromotionsTiersCreateResponseBodySummaryOrders.md new file mode 100644 index 00000000..3a18b0f3 --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodySummaryOrders.md @@ -0,0 +1,14 @@ +# PromotionsTiersCreateResponseBodySummaryOrders + +Contains statistics about orders related to the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/PromotionsTiersCreateResponseBodySummaryRedemptions.md b/docs/PromotionsTiersCreateResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..75eb1a86 --- /dev/null +++ b/docs/PromotionsTiersCreateResponseBodySummaryRedemptions.md @@ -0,0 +1,13 @@ +# PromotionsTiersCreateResponseBodySummaryRedemptions + +Contains statistics about promotion tier redemptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/PromotionsTiersDisableResponseBody.md b/docs/PromotionsTiersDisableResponseBody.md new file mode 100644 index 00000000..bc2f06bd --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBody.md @@ -0,0 +1,34 @@ +# PromotionsTiersDisableResponseBody + +Response body schema for **POST** `v1/promotions/tiers/{promotionTierId}/disable`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionsTiersDisableResponseBodyAction**](PromotionsTiersDisableResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**PromotionsTiersDisableResponseBodyCampaign**](PromotionsTiersDisableResponseBodyCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**PromotionsTiersDisableResponseBodySummary**](PromotionsTiersDisableResponseBodySummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/PromotionsTiersDisableResponseBodyAction.md b/docs/PromotionsTiersDisableResponseBodyAction.md new file mode 100644 index 00000000..92d558ca --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodyAction.md @@ -0,0 +1,13 @@ +# PromotionsTiersDisableResponseBodyAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionsTiersDisableResponseBodyCampaign.md b/docs/PromotionsTiersDisableResponseBodyCampaign.md new file mode 100644 index 00000000..cfd1680d --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodyCampaign.md @@ -0,0 +1,21 @@ +# PromotionsTiersDisableResponseBodyCampaign + +Contains details about promotion tier's parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/PromotionsTiersDisableResponseBodySummary.md b/docs/PromotionsTiersDisableResponseBodySummary.md new file mode 100644 index 00000000..6c87f68c --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodySummary.md @@ -0,0 +1,14 @@ +# PromotionsTiersDisableResponseBodySummary + +Contains statistics about promotion tier redemptions and orders. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**PromotionsTiersDisableResponseBodySummaryRedemptions**](PromotionsTiersDisableResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**PromotionsTiersDisableResponseBodySummaryOrders**](PromotionsTiersDisableResponseBodySummaryOrders.md) | | [optional] + +[[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/PromotionsTiersDisableResponseBodySummaryOrders.md b/docs/PromotionsTiersDisableResponseBodySummaryOrders.md new file mode 100644 index 00000000..683a7228 --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodySummaryOrders.md @@ -0,0 +1,14 @@ +# PromotionsTiersDisableResponseBodySummaryOrders + +Contains statistics about orders related to the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/PromotionsTiersDisableResponseBodySummaryRedemptions.md b/docs/PromotionsTiersDisableResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..7f9bafa4 --- /dev/null +++ b/docs/PromotionsTiersDisableResponseBodySummaryRedemptions.md @@ -0,0 +1,13 @@ +# PromotionsTiersDisableResponseBodySummaryRedemptions + +Contains statistics about promotion tier redemptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/PromotionsTiersEnableResponseBody.md b/docs/PromotionsTiersEnableResponseBody.md new file mode 100644 index 00000000..2a3368d8 --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBody.md @@ -0,0 +1,34 @@ +# PromotionsTiersEnableResponseBody + +Response body schema for **POST** `v1/promotions/tiers/{promotionTierId}/enable`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionsTiersEnableResponseBodyAction**](PromotionsTiersEnableResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**PromotionsTiersEnableResponseBodyCampaign**](PromotionsTiersEnableResponseBodyCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**PromotionsTiersEnableResponseBodySummary**](PromotionsTiersEnableResponseBodySummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/PromotionsTiersEnableResponseBodyAction.md b/docs/PromotionsTiersEnableResponseBodyAction.md new file mode 100644 index 00000000..4fd3bc89 --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodyAction.md @@ -0,0 +1,13 @@ +# PromotionsTiersEnableResponseBodyAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionsTiersEnableResponseBodyCampaign.md b/docs/PromotionsTiersEnableResponseBodyCampaign.md new file mode 100644 index 00000000..6c95f42c --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodyCampaign.md @@ -0,0 +1,21 @@ +# PromotionsTiersEnableResponseBodyCampaign + +Contains details about promotion tier's parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/PromotionsTiersEnableResponseBodySummary.md b/docs/PromotionsTiersEnableResponseBodySummary.md new file mode 100644 index 00000000..793fef02 --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodySummary.md @@ -0,0 +1,14 @@ +# PromotionsTiersEnableResponseBodySummary + +Contains statistics about promotion tier redemptions and orders. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**PromotionsTiersEnableResponseBodySummaryRedemptions**](PromotionsTiersEnableResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**PromotionsTiersEnableResponseBodySummaryOrders**](PromotionsTiersEnableResponseBodySummaryOrders.md) | | [optional] + +[[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/PromotionsTiersEnableResponseBodySummaryOrders.md b/docs/PromotionsTiersEnableResponseBodySummaryOrders.md new file mode 100644 index 00000000..6b1681fb --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodySummaryOrders.md @@ -0,0 +1,14 @@ +# PromotionsTiersEnableResponseBodySummaryOrders + +Contains statistics about orders related to the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/PromotionsTiersEnableResponseBodySummaryRedemptions.md b/docs/PromotionsTiersEnableResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..2c27f0ba --- /dev/null +++ b/docs/PromotionsTiersEnableResponseBodySummaryRedemptions.md @@ -0,0 +1,13 @@ +# PromotionsTiersEnableResponseBodySummaryRedemptions + +Contains statistics about promotion tier redemptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/PromotionsTiersGetResponseBody.md b/docs/PromotionsTiersGetResponseBody.md new file mode 100644 index 00000000..d1bb2b40 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBody.md @@ -0,0 +1,34 @@ +# PromotionsTiersGetResponseBody + +Response body schema for **GET** `v1/promotions/tiers/{promotionTierId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionsTiersGetResponseBodyAction**](PromotionsTiersGetResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**PromotionsTiersGetResponseBodyCampaign**](PromotionsTiersGetResponseBodyCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**PromotionsTiersGetResponseBodySummary**](PromotionsTiersGetResponseBodySummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/PromotionsTiersGetResponseBodyAction.md b/docs/PromotionsTiersGetResponseBodyAction.md new file mode 100644 index 00000000..f6861f27 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodyAction.md @@ -0,0 +1,13 @@ +# PromotionsTiersGetResponseBodyAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionsTiersGetResponseBodyCampaign.md b/docs/PromotionsTiersGetResponseBodyCampaign.md new file mode 100644 index 00000000..7b857186 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodyCampaign.md @@ -0,0 +1,21 @@ +# PromotionsTiersGetResponseBodyCampaign + +Contains details about promotion tier's parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/PromotionsTiersGetResponseBodySummary.md b/docs/PromotionsTiersGetResponseBodySummary.md new file mode 100644 index 00000000..19663499 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodySummary.md @@ -0,0 +1,14 @@ +# PromotionsTiersGetResponseBodySummary + +Contains statistics about promotion tier redemptions and orders. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**PromotionsTiersGetResponseBodySummaryRedemptions**](PromotionsTiersGetResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**PromotionsTiersGetResponseBodySummaryOrders**](PromotionsTiersGetResponseBodySummaryOrders.md) | | [optional] + +[[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/PromotionsTiersGetResponseBodySummaryOrders.md b/docs/PromotionsTiersGetResponseBodySummaryOrders.md new file mode 100644 index 00000000..70a7eab4 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodySummaryOrders.md @@ -0,0 +1,14 @@ +# PromotionsTiersGetResponseBodySummaryOrders + +Contains statistics about orders related to the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/PromotionsTiersGetResponseBodySummaryRedemptions.md b/docs/PromotionsTiersGetResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..6122c6a6 --- /dev/null +++ b/docs/PromotionsTiersGetResponseBodySummaryRedemptions.md @@ -0,0 +1,13 @@ +# PromotionsTiersGetResponseBodySummaryRedemptions + +Contains statistics about promotion tier redemptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/PromotionsTiersListResponseBody.md b/docs/PromotionsTiersListResponseBody.md new file mode 100644 index 00000000..20eabd76 --- /dev/null +++ b/docs/PromotionsTiersListResponseBody.md @@ -0,0 +1,17 @@ +# PromotionsTiersListResponseBody + +Response body schema for **GET** `v1/promotions/{campaignId}/tiers` and **GET** `v1/promotions/tiers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of promotion tier objects. | [optional] [default to 'tiers'] +**tiers** | [**List[PromotionTier]**](PromotionTier.md) | Contains array of promotion tier objects. | [optional] +**total** | **int** | Total number of promotion tiers. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results. | [optional] + +[[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/PromotionsTiersUpdateRequestBody.md b/docs/PromotionsTiersUpdateRequestBody.md new file mode 100644 index 00000000..cb6d7d04 --- /dev/null +++ b/docs/PromotionsTiersUpdateRequestBody.md @@ -0,0 +1,25 @@ +# PromotionsTiersUpdateRequestBody + +Request body schema for **PUT** `v1/promotions/tiers/{promotionTierId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionsTiersUpdateRequestBodyAction**](PromotionsTiersUpdateRequestBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category** | **str** | Assign a new or update the promotion tier's category using name. | [optional] +**category_id** | **str** | Assign a new or update the promotion tier's category using id | [optional] + +[[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/PromotionsTiersUpdateRequestBodyAction.md b/docs/PromotionsTiersUpdateRequestBodyAction.md new file mode 100644 index 00000000..b84530fd --- /dev/null +++ b/docs/PromotionsTiersUpdateRequestBodyAction.md @@ -0,0 +1,13 @@ +# PromotionsTiersUpdateRequestBodyAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionsTiersUpdateResponseBody.md b/docs/PromotionsTiersUpdateResponseBody.md new file mode 100644 index 00000000..c1c23842 --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBody.md @@ -0,0 +1,34 @@ +# PromotionsTiersUpdateResponseBody + +Response body schema for **PUT** `v1/promotions/tiers/{promotionTierId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**PromotionsTiersUpdateResponseBodyAction**](PromotionsTiersUpdateResponseBodyAction.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format. | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**PromotionsTiersUpdateResponseBodyCampaign**](PromotionsTiersUpdateResponseBodyCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**PromotionsTiersUpdateResponseBodySummary**](PromotionsTiersUpdateResponseBodySummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/PromotionsTiersUpdateResponseBodyAction.md b/docs/PromotionsTiersUpdateResponseBodyAction.md new file mode 100644 index 00000000..25d8877c --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodyAction.md @@ -0,0 +1,13 @@ +# PromotionsTiersUpdateResponseBodyAction + +Contains details about the discount applied by the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/PromotionsTiersUpdateResponseBodyCampaign.md b/docs/PromotionsTiersUpdateResponseBodyCampaign.md new file mode 100644 index 00000000..fcd75a28 --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodyCampaign.md @@ -0,0 +1,21 @@ +# PromotionsTiersUpdateResponseBodyCampaign + +Contains details about promotion tier's parent campaign. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/PromotionsTiersUpdateResponseBodySummary.md b/docs/PromotionsTiersUpdateResponseBodySummary.md new file mode 100644 index 00000000..704cc0a9 --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodySummary.md @@ -0,0 +1,14 @@ +# PromotionsTiersUpdateResponseBodySummary + +Contains statistics about promotion tier redemptions and orders. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**PromotionsTiersUpdateResponseBodySummaryRedemptions**](PromotionsTiersUpdateResponseBodySummaryRedemptions.md) | | [optional] +**orders** | [**PromotionsTiersUpdateResponseBodySummaryOrders**](PromotionsTiersUpdateResponseBodySummaryOrders.md) | | [optional] + +[[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/PromotionsTiersUpdateResponseBodySummaryOrders.md b/docs/PromotionsTiersUpdateResponseBodySummaryOrders.md new file mode 100644 index 00000000..27ccf95f --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodySummaryOrders.md @@ -0,0 +1,14 @@ +# PromotionsTiersUpdateResponseBodySummaryOrders + +Contains statistics about orders related to the promotion tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/PromotionsTiersUpdateResponseBodySummaryRedemptions.md b/docs/PromotionsTiersUpdateResponseBodySummaryRedemptions.md new file mode 100644 index 00000000..52011e02 --- /dev/null +++ b/docs/PromotionsTiersUpdateResponseBodySummaryRedemptions.md @@ -0,0 +1,13 @@ +# PromotionsTiersUpdateResponseBodySummaryRedemptions + +Contains statistics about promotion tier redemptions. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/PublicationsApi.md b/docs/PublicationsApi.md new file mode 100644 index 00000000..00830333 --- /dev/null +++ b/docs/PublicationsApi.md @@ -0,0 +1,307 @@ +# voucherify.PublicationsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_publication**](PublicationsApi.md#create_publication) | **POST** /v1/publications | Create Publication +[**create_publication1**](PublicationsApi.md#create_publication1) | **GET** /v1/publications/create | Create Publication +[**list_publications**](PublicationsApi.md#list_publications) | **GET** /v1/publications | List Publications + + +# **create_publication** +> PublicationsCreateResponseBody create_publication(join_once=join_once, publications_create_request_body=publications_create_request_body) + +Create Publication + +This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.publications_create_request_body import PublicationsCreateRequestBody +from voucherify.models.publications_create_response_body import PublicationsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PublicationsApi(api_client) + join_once = True # bool | Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + publications_create_request_body = {"campaign":{"name":"campaign-name"},"customer":{"source_id":"source-id","Name":"Customer Name","email":"customer email"},"voucher":"voucher-code","metadata":{"key":"value"}} # PublicationsCreateRequestBody | Specify the publication parameters. (optional) + + try: + # Create Publication + api_response = api_instance.create_publication(join_once=join_once, publications_create_request_body=publications_create_request_body) + print("The response of PublicationsApi->create_publication:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PublicationsApi->create_publication: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **join_once** | **bool**| Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. | [optional] + **publications_create_request_body** | [**PublicationsCreateRequestBody**](PublicationsCreateRequestBody.md)| Specify the publication parameters. | [optional] + +### Return type + +[**PublicationsCreateResponseBody**](PublicationsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a publication object if a valid identifier was provided. | - | + +[[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) + +# **create_publication1** +> PublicationsCreateResponseBody create_publication1(customer, join_once=join_once, voucher=voucher, campaign=campaign, source_id=source_id, metadata=metadata) + +Create Publication + +This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. โ—๏ธ Limited access Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a dedicated endpoint. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. # Example Request โ—๏ธ Required Query param voucher OR campaign MUST be filled out. If you provide both, campaign param will be skipped. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.create_publication_campaign import CreatePublicationCampaign +from voucherify.models.customer import Customer +from voucherify.models.publications_create_response_body import PublicationsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PublicationsApi(api_client) + customer = voucherify.Customer() # Customer | Contains information about the customer to whom the publication was directed. + join_once = True # bool | Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. (optional) + voucher = 'voucher_example' # str | Code of voucher being published. (optional) + campaign = voucherify.CreatePublicationCampaign() # CreatePublicationCampaign | Create publication with campaign. (optional) + source_id = 'source_id_example' # str | The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. (optional) + metadata = None # object | The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. (optional) + + try: + # Create Publication + api_response = api_instance.create_publication1(customer, join_once=join_once, voucher=voucher, campaign=campaign, source_id=source_id, metadata=metadata) + print("The response of PublicationsApi->create_publication1:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PublicationsApi->create_publication1: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **customer** | [**Customer**](.md)| Contains information about the customer to whom the publication was directed. | + **join_once** | **bool**| Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. | [optional] + **voucher** | **str**| Code of voucher being published. | [optional] + **campaign** | [**CreatePublicationCampaign**](.md)| Create publication with campaign. | [optional] + **source_id** | **str**| The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. | [optional] + **metadata** | [**object**](.md)| The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. | [optional] + +### Return type + +[**PublicationsCreateResponseBody**](PublicationsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a publication object. | - | + +[[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) + +# **list_publications** +> PublicationsListResponseBody list_publications(limit=limit, page=page, order=order, campaign=campaign, customer=customer, voucher=voucher, result=result, voucher_type=voucher_type, is_referral_code=is_referral_code, filters=filters, source_id=source_id) + +List Publications + +Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination ๐Ÿšง Important! If you want to scroll through a huge set of records, it is recommended to use the Exports API. This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Operators: ## Examples + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order_list_publications import ParameterOrderListPublications +from voucherify.models.parameter_result_list_publications import ParameterResultListPublications +from voucherify.models.parameter_voucher_type_list_publications import ParameterVoucherTypeListPublications +from voucherify.models.publications_list_response_body import PublicationsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.PublicationsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListPublications() # ParameterOrderListPublications | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + campaign = 'campaign_example' # str | Filters by a given campaign name. (optional) + customer = 'customer_example' # str | Filters by a unique customer ID. (optional) + voucher = 'voucher_example' # str | Filters by a given voucher code. (optional) + result = voucherify.ParameterResultListPublications() # ParameterResultListPublications | Filters by a publication result. (optional) + voucher_type = voucherify.ParameterVoucherTypeListPublications() # ParameterVoucherTypeListPublications | Filters by a voucher type. (optional) + is_referral_code = True # bool | This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. (optional) + filters = 'filters_example' # str | Allows for combining the filters mentioned in the endpoint description. (optional) + source_id = 'source_id_example' # str | Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. (optional) + + try: + # List Publications + api_response = api_instance.list_publications(limit=limit, page=page, order=order, campaign=campaign, customer=customer, voucher=voucher, result=result, voucher_type=voucher_type, is_referral_code=is_referral_code, filters=filters, source_id=source_id) + print("The response of PublicationsApi->list_publications:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PublicationsApi->list_publications: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListPublications**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **campaign** | **str**| Filters by a given campaign name. | [optional] + **customer** | **str**| Filters by a unique customer ID. | [optional] + **voucher** | **str**| Filters by a given voucher code. | [optional] + **result** | [**ParameterResultListPublications**](.md)| Filters by a publication result. | [optional] + **voucher_type** | [**ParameterVoucherTypeListPublications**](.md)| Filters by a voucher type. | [optional] + **is_referral_code** | **bool**| This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. | [optional] + **filters** | **str**| Allows for combining the filters mentioned in the endpoint description. | [optional] + **source_id** | **str**| Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. | [optional] + +### Return type + +[**PublicationsListResponseBody**](PublicationsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of publications you've previously created with <!-- [create publication](OpenAPI.json/paths/~1publications/post) -->[create publication](ref:create-publication) or implicitly by the distribution manager. The publications are returned in sorted order, with the most recent ones appearing first. | - | + +[[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) + diff --git a/docs/PublicationsCreateRequestBody.md b/docs/PublicationsCreateRequestBody.md new file mode 100644 index 00000000..eee25785 --- /dev/null +++ b/docs/PublicationsCreateRequestBody.md @@ -0,0 +1,17 @@ +# PublicationsCreateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucher** | **str** | Code of the voucher being published. | [optional] +**source_id** | **str** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request. | [optional] +**customer** | [**PublicationsCreateRequestBodyCustomer**](PublicationsCreateRequestBodyCustomer.md) | | [optional] +**metadata** | **object** | | [optional] +**channel** | **str** | Specify the distribution channel. | [optional] +**campaign** | [**CreatePublicationCampaign**](CreatePublicationCampaign.md) | | [optional] + +[[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/PublicationsCreateRequestBodyCustomer.md b/docs/PublicationsCreateRequestBodyCustomer.md new file mode 100644 index 00000000..68c67db7 --- /dev/null +++ b/docs/PublicationsCreateRequestBodyCustomer.md @@ -0,0 +1,21 @@ +# PublicationsCreateRequestBodyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**PublicationsCreateRequestBodyCustomerAddress**](PublicationsCreateRequestBodyCustomerAddress.md) | | [optional] +**metadata** | **object** | | [optional] + +[[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/PublicationsCreateRequestBodyCustomerAddress.md b/docs/PublicationsCreateRequestBodyCustomerAddress.md new file mode 100644 index 00000000..2ebbb282 --- /dev/null +++ b/docs/PublicationsCreateRequestBodyCustomerAddress.md @@ -0,0 +1,17 @@ +# PublicationsCreateRequestBodyCustomerAddress + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/PublicationsCreateResponseBody.md b/docs/PublicationsCreateResponseBody.md new file mode 100644 index 00000000..aa23905b --- /dev/null +++ b/docs/PublicationsCreateResponseBody.md @@ -0,0 +1,24 @@ +# PublicationsCreateResponseBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique publication ID, assigned by Voucherify. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the `publication`. | [optional] [default to 'publication'] +**created_at** | **datetime** | Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer receiving the publication. | [optional] +**tracking_id** | **str** | Customer's `source_id`. | [optional] +**metadata** | **object** | | [optional] +**channel** | **str** | How the publication was originated. It can be your own custom channel or an example value provided here. | [optional] [default to 'API'] +**source_id** | **str** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | [optional] +**result** | **str** | Status of the publication attempt. | [optional] [default to 'SUCCESS'] +**customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] +**vouchers_id** | **List[str]** | Contains the unique internal voucher ID that was assigned by Voucherify. | [optional] +**voucher** | [**Voucher**](Voucher.md) | | [optional] +**vouchers** | **List[str]** | Contains the unique voucher codes that was assigned by Voucherify. | [optional] + +[[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/PublicationsListResponseBody.md b/docs/PublicationsListResponseBody.md new file mode 100644 index 00000000..caada333 --- /dev/null +++ b/docs/PublicationsListResponseBody.md @@ -0,0 +1,16 @@ +# PublicationsListResponseBody + +Response body schema for listing publications using **GET** `v1/publications`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about publications in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of publications. | [optional] [default to 'publications'] +**publications** | [**List[PublicationsListResponseBodyPublicationsItem]**](PublicationsListResponseBodyPublicationsItem.md) | Response schema model for publishing vouchers to a specific customer. | [optional] +**total** | **int** | Total number of publications. | [optional] + +[[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/PublicationsListResponseBodyPublicationsItem.md b/docs/PublicationsListResponseBodyPublicationsItem.md new file mode 100644 index 00000000..d628f7a0 --- /dev/null +++ b/docs/PublicationsListResponseBodyPublicationsItem.md @@ -0,0 +1,26 @@ +# PublicationsListResponseBodyPublicationsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique publication ID, assigned by Voucherify. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the `publication`. | [optional] [default to 'publication'] +**created_at** | **datetime** | Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer receiving the publication. | [optional] +**tracking_id** | **str** | Customer's `source_id`. | [optional] +**metadata** | [**PublicationsListResponseBodyPublicationsItemMetadata**](PublicationsListResponseBodyPublicationsItemMetadata.md) | | [optional] +**channel** | **str** | How the publication was originated. It can be your own custom channel or an example value provided here. | [optional] +**source_id** | **str** | The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. | [optional] +**customer** | [**CustomerWithSummaryLoyaltyReferrals**](CustomerWithSummaryLoyaltyReferrals.md) | | [optional] +**vouchers** | **List[str]** | Contains the voucher IDs that was assigned by Voucherify. and Contains the unique voucher codes that was assigned by Voucherify. | [optional] +**vouchers_id** | **List[str]** | Contains the unique internal voucher IDs that was assigned by Voucherify. | [optional] +**result** | **str** | | [optional] +**voucher** | [**ListPublicationsItemVoucher**](ListPublicationsItemVoucher.md) | | [optional] +**failure_code** | **str** | Generic reason as to why the create publication operation failed. | [optional] +**failure_message** | **str** | This parameter will provide more expanded reason as to why the create publication operation failed. | [optional] + +[[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/PublicationsListResponseBodyPublicationsItemMetadata.md b/docs/PublicationsListResponseBodyPublicationsItemMetadata.md new file mode 100644 index 00000000..8d4006b5 --- /dev/null +++ b/docs/PublicationsListResponseBodyPublicationsItemMetadata.md @@ -0,0 +1,14 @@ +# PublicationsListResponseBodyPublicationsItemMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_type** | **str** | Defines the type of the distribution source. | [optional] +**source_id** | **str** | Unique identifier of the distribution source. | [optional] +**distribution_id** | **str** | Unique identifier of the distribution. | [optional] + +[[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/QualificationsApi.md b/docs/QualificationsApi.md new file mode 100644 index 00000000..a5b0bf82 --- /dev/null +++ b/docs/QualificationsApi.md @@ -0,0 +1,96 @@ +# voucherify.QualificationsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**check_eligibility**](QualificationsApi.md#check_eligibility) | **POST** /v1/qualifications | Check Eligibility + + +# **check_eligibility** +> QualificationsCheckEligibilityResponseBody check_eligibility(qualifications_check_eligibility_request_body=qualifications_check_eligibility_request_body) + +Check Eligibility + + ๐Ÿšง The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.qualifications_check_eligibility_request_body import QualificationsCheckEligibilityRequestBody +from voucherify.models.qualifications_check_eligibility_response_body import QualificationsCheckEligibilityResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.QualificationsApi(api_client) + qualifications_check_eligibility_request_body = voucherify.QualificationsCheckEligibilityRequestBody() # QualificationsCheckEligibilityRequestBody | Define order and customer context. (optional) + + try: + # Check Eligibility + api_response = api_instance.check_eligibility(qualifications_check_eligibility_request_body=qualifications_check_eligibility_request_body) + print("The response of QualificationsApi->check_eligibility:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QualificationsApi->check_eligibility: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **qualifications_check_eligibility_request_body** | [**QualificationsCheckEligibilityRequestBody**](QualificationsCheckEligibilityRequestBody.md)| Define order and customer context. | [optional] + +### Return type + +[**QualificationsCheckEligibilityResponseBody**](QualificationsCheckEligibilityResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a qualifications object. | - | + +[[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) + diff --git a/docs/QualificationsCheckEligibilityRequestBody.md b/docs/QualificationsCheckEligibilityRequestBody.md new file mode 100644 index 00000000..e1a69c4c --- /dev/null +++ b/docs/QualificationsCheckEligibilityRequestBody.md @@ -0,0 +1,18 @@ +# QualificationsCheckEligibilityRequestBody + +Request body schema for **POST** `v1/qualifications`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer** | [**Customer**](Customer.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**tracking_id** | **str** | Is correspondent to Customer's source_id | [optional] +**scenario** | **str** | Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s). | [optional] +**options** | [**QualificationsOption**](QualificationsOption.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the <!-- [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) -->[Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr; _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_ &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). | [optional] + +[[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/QualificationsCheckEligibilityResponseBody.md b/docs/QualificationsCheckEligibilityResponseBody.md new file mode 100644 index 00000000..1ee0588a --- /dev/null +++ b/docs/QualificationsCheckEligibilityResponseBody.md @@ -0,0 +1,16 @@ +# QualificationsCheckEligibilityResponseBody + +Response body schema for **POST** `v1/qualifications`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemables** | [**QualificationsRedeemables**](QualificationsRedeemables.md) | | [optional] +**tracking_id** | **str** | This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**stacking_rules** | [**StackingRules**](StackingRules.md) | | [optional] + +[[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/QualificationsFieldConditions.md b/docs/QualificationsFieldConditions.md new file mode 100644 index 00000000..ff5f65b2 --- /dev/null +++ b/docs/QualificationsFieldConditions.md @@ -0,0 +1,12 @@ +# QualificationsFieldConditions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**QualificationsFiltersCondition**](QualificationsFiltersCondition.md) | | [optional] + +[[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/QualificationsFiltersCondition.md b/docs/QualificationsFiltersCondition.md new file mode 100644 index 00000000..ad9cd492 --- /dev/null +++ b/docs/QualificationsFiltersCondition.md @@ -0,0 +1,17 @@ +# QualificationsFiltersCondition + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_is** | **List[str]** | | [optional] +**is_not** | **List[str]** | | [optional] +**has_value** | **object** | | [optional] +**is_unknown** | **object** | | [optional] +**var_in** | **List[str]** | | [optional] +**not_in** | **List[str]** | | [optional] + +[[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/QualificationsOption.md b/docs/QualificationsOption.md new file mode 100644 index 00000000..26995bc2 --- /dev/null +++ b/docs/QualificationsOption.md @@ -0,0 +1,17 @@ +# QualificationsOption + +Configure parameters returned in the response. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**limit** | **int** | The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5 | [optional] +**starting_after** | **datetime** | Cursor used for paging. | [optional] +**filters** | [**QualificationsOptionFilters**](QualificationsOptionFilters.md) | | [optional] +**expand** | **List[str]** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"redeemable\"] | - Returns the redeemables' metadata. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [\"validation_rules\"] | - Returns an expanded `validation_rules` object, showing details about the validation rules. | | [optional] +**sorting_rule** | **str** | Is used to determine the order in which data is displayed in the result array. - `DEFAULT` - Sorting descending by `created_at` - `BEST_DEAL` - Sorting descending by `total_applied_discount_amount` - `LEAST_DEAL` - Sorting ascending by `total_applied_discount_amount` | [optional] + +[[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/QualificationsOptionFilters.md b/docs/QualificationsOptionFilters.md new file mode 100644 index 00000000..c942d91f --- /dev/null +++ b/docs/QualificationsOptionFilters.md @@ -0,0 +1,21 @@ +# QualificationsOptionFilters + +A set of filters to return only a specific category or type of redeemable. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**junction** | [**Junction**](Junction.md) | | [optional] +**category_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**campaign_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**campaign_type** | [**QualificationsOptionFiltersCampaignType**](QualificationsOptionFiltersCampaignType.md) | | [optional] +**resource_id** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**resource_type** | [**QualificationsOptionFiltersResourceType**](QualificationsOptionFiltersResourceType.md) | | [optional] +**voucher_type** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**code** | [**QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**holder_role** | [**QualificationsOptionFiltersHolderRole**](QualificationsOptionFiltersHolderRole.md) | | [optional] + +[[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/QualificationsOptionFiltersCampaignType.md b/docs/QualificationsOptionFiltersCampaignType.md new file mode 100644 index 00000000..5e2b226d --- /dev/null +++ b/docs/QualificationsOptionFiltersCampaignType.md @@ -0,0 +1,13 @@ +# QualificationsOptionFiltersCampaignType + +Returns both campaigns and their vouchers or promotion tiers. Use other filters, e.g. `resource_type`, to narrow down the results. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**QualificationsOptionFiltersCampaignTypeConditions**](QualificationsOptionFiltersCampaignTypeConditions.md) | | [optional] + +[[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/QualificationsOptionFiltersCampaignTypeConditions.md b/docs/QualificationsOptionFiltersCampaignTypeConditions.md new file mode 100644 index 00000000..6b9f996f --- /dev/null +++ b/docs/QualificationsOptionFiltersCampaignTypeConditions.md @@ -0,0 +1,16 @@ +# QualificationsOptionFiltersCampaignTypeConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_is** | [**List[ParameterCampaignType]**](ParameterCampaignType.md) | | [optional] +**is_not** | [**List[ParameterCampaignType]**](ParameterCampaignType.md) | | [optional] +**var_in** | [**List[ParameterCampaignType]**](ParameterCampaignType.md) | | [optional] +**not_in** | [**List[ParameterCampaignType]**](ParameterCampaignType.md) | | [optional] + +[[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/QualificationsOptionFiltersHolderRole.md b/docs/QualificationsOptionFiltersHolderRole.md new file mode 100644 index 00000000..ac443649 --- /dev/null +++ b/docs/QualificationsOptionFiltersHolderRole.md @@ -0,0 +1,12 @@ +# QualificationsOptionFiltersHolderRole + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**QualificationsOptionFiltersHolderRoleConditions**](QualificationsOptionFiltersHolderRoleConditions.md) | | [optional] + +[[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/QualificationsOptionFiltersHolderRoleConditions.md b/docs/QualificationsOptionFiltersHolderRoleConditions.md new file mode 100644 index 00000000..edf12ccc --- /dev/null +++ b/docs/QualificationsOptionFiltersHolderRoleConditions.md @@ -0,0 +1,16 @@ +# QualificationsOptionFiltersHolderRoleConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_is** | **List[str]** | Will return records only for the first value in the array. | [optional] +**is_not** | **List[str]** | Will return records only for the first value in the array. | [optional] +**var_in** | **List[str]** | Will return records for the values in the array. | [optional] +**not_in** | **List[str]** | Will return records for the values in the array. | [optional] + +[[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/QualificationsOptionFiltersResourceType.md b/docs/QualificationsOptionFiltersResourceType.md new file mode 100644 index 00000000..51406357 --- /dev/null +++ b/docs/QualificationsOptionFiltersResourceType.md @@ -0,0 +1,12 @@ +# QualificationsOptionFiltersResourceType + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**QualificationsOptionFiltersResourceTypeConditions**](QualificationsOptionFiltersResourceTypeConditions.md) | | [optional] + +[[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/QualificationsOptionFiltersResourceTypeConditions.md b/docs/QualificationsOptionFiltersResourceTypeConditions.md new file mode 100644 index 00000000..811e41df --- /dev/null +++ b/docs/QualificationsOptionFiltersResourceTypeConditions.md @@ -0,0 +1,16 @@ +# QualificationsOptionFiltersResourceTypeConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_is** | [**List[ResourceTypes]**](ResourceTypes.md) | | [optional] +**is_not** | [**List[ResourceTypes]**](ResourceTypes.md) | | [optional] +**var_in** | [**List[ResourceTypes]**](ResourceTypes.md) | | [optional] +**not_in** | [**List[ResourceTypes]**](ResourceTypes.md) | | [optional] + +[[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/QualificationsRedeemable.md b/docs/QualificationsRedeemable.md new file mode 100644 index 00000000..91f91236 --- /dev/null +++ b/docs/QualificationsRedeemable.md @@ -0,0 +1,27 @@ +# QualificationsRedeemable + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Id of the redeemable. | [optional] +**object** | **str** | Object type of the redeemable. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**result** | [**RedeemableResult**](RedeemableResult.md) | | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**applicable_to** | [**ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicable_to** | [**InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**categories** | [**List[Category]**](Category.md) | List of category information. | [optional] +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**name** | **str** | Name of the redeemable. | [optional] +**campaign_name** | **str** | Name of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**campaign_id** | **str** | Id of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**redeemables** | [**List[QualificationsRedeemableBase]**](QualificationsRedeemableBase.md) | | [optional] + +[[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/QualificationsRedeemableBase.md b/docs/QualificationsRedeemableBase.md new file mode 100644 index 00000000..5de268e9 --- /dev/null +++ b/docs/QualificationsRedeemableBase.md @@ -0,0 +1,27 @@ +# QualificationsRedeemableBase + +Data of single redeemable which was properly qualified. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Id of the redeemable. | [optional] +**object** | **str** | Object type of the redeemable. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**result** | [**RedeemableResult**](RedeemableResult.md) | | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**validation_rule_id** | **str** | A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. | [optional] +**applicable_to** | [**ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicable_to** | [**InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format. | [optional] +**categories** | [**List[Category]**](Category.md) | List of category information. | [optional] +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] +**name** | **str** | Name of the redeemable. | [optional] +**campaign_name** | **str** | Name of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**campaign_id** | **str** | Id of the campaign associated to the redeemable. This field is available only if object is not `campaign` | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/QualificationsRedeemables.md b/docs/QualificationsRedeemables.md new file mode 100644 index 00000000..f943dc3b --- /dev/null +++ b/docs/QualificationsRedeemables.md @@ -0,0 +1,18 @@ +# QualificationsRedeemables + +List of redeemables for examine qualification. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. Default is `list`. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of qualified redeemables. | [optional] [default to 'data'] +**data** | [**List[QualificationsRedeemable]**](QualificationsRedeemable.md) | Array of qualified redeemables. | [optional] +**total** | **int** | The number of redeemables returned in the API request. | [optional] +**has_more** | **bool** | As results are always limited, the `has_more` flag indicates if there are more records for given parameters. This lets you know if you can run another request (with different options) to get more records returned in the results. | [optional] +**more_starting_after** | **datetime** | Timestamp representing the date and time to use in `starting_after` cursor to get more redeemables. | [optional] + +[[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/RedeemableGift.md b/docs/RedeemableGift.md new file mode 100644 index 00000000..ed09e7b7 --- /dev/null +++ b/docs/RedeemableGift.md @@ -0,0 +1,14 @@ +# RedeemableGift + +Contains current gift card balance information. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | **float** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**credits** | **float** | The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[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/RedeemableLoyaltyCard.md b/docs/RedeemableLoyaltyCard.md new file mode 100644 index 00000000..806c8a3d --- /dev/null +++ b/docs/RedeemableLoyaltyCard.md @@ -0,0 +1,17 @@ +# RedeemableLoyaltyCard + +Redeemable loyalty card object response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**exchange_ratio** | **float** | The cash equivalent of the points defined in the points_ratio property. | [optional] +**points_ratio** | **int** | The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. | [optional] +**transfers** | [**List[LoyaltiesTransferPoints]**](LoyaltiesTransferPoints.md) | | [optional] + +[[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/RedeemableResult.md b/docs/RedeemableResult.md new file mode 100644 index 00000000..47a06ba6 --- /dev/null +++ b/docs/RedeemableResult.md @@ -0,0 +1,16 @@ +# RedeemableResult + +Information about redeemable result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**RedeemableGift**](RedeemableGift.md) | | [optional] +**loyalty_card** | [**RedeemableLoyaltyCard**](RedeemableLoyaltyCard.md) | | [optional] +**error** | [**Error**](Error.md) | | [optional] + +[[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/RedeemableVoucher.md b/docs/RedeemableVoucher.md new file mode 100644 index 00000000..c1ddea08 --- /dev/null +++ b/docs/RedeemableVoucher.md @@ -0,0 +1,40 @@ +# RedeemableVoucher + +This is an object representing a voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | The value is null. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**categories** | **List[object]** | Contains an empty array. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**RedeemableVoucherGift**](RedeemableVoucherGift.md) | | [optional] +**loyalty_card** | [**RedeemableVoucherLoyaltyCard**](RedeemableVoucherLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**RedeemableVoucherPublish**](RedeemableVoucherPublish.md) | | [optional] +**redemption** | [**RedeemableVoucherRedemption**](RedeemableVoucherRedemption.md) | | [optional] + +[[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/RedeemableVoucherGift.md b/docs/RedeemableVoucherGift.md new file mode 100644 index 00000000..d1801e06 --- /dev/null +++ b/docs/RedeemableVoucherGift.md @@ -0,0 +1,15 @@ +# RedeemableVoucherGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/RedeemableVoucherLoyaltyCard.md b/docs/RedeemableVoucherLoyaltyCard.md new file mode 100644 index 00000000..d7dfc2b0 --- /dev/null +++ b/docs/RedeemableVoucherLoyaltyCard.md @@ -0,0 +1,16 @@ +# RedeemableVoucherLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/RedeemableVoucherPublish.md b/docs/RedeemableVoucherPublish.md new file mode 100644 index 00000000..6bd62f31 --- /dev/null +++ b/docs/RedeemableVoucherPublish.md @@ -0,0 +1,15 @@ +# RedeemableVoucherPublish + +This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/RedeemableVoucherRedemption.md b/docs/RedeemableVoucherRedemption.md new file mode 100644 index 00000000..b3fdb9a8 --- /dev/null +++ b/docs/RedeemableVoucherRedemption.md @@ -0,0 +1,17 @@ +# RedeemableVoucherRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/Redemption.md b/docs/Redemption.md new file mode 100644 index 00000000..5d3d0381 --- /dev/null +++ b/docs/Redemption.md @@ -0,0 +1,35 @@ +# Redemption + +This is an object representing a redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**object** | **str** | The type of the object represented by the JSON | [optional] [default to 'redemption'] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the redeeming customer. | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. | [optional] +**redemption** | **str** | Unique redemption ID of the parent redemption. | [optional] +**result** | **str** | Redemption result. | [optional] +**status** | **str** | Redemption status. | [optional] +**related_redemptions** | [**RedemptionRelatedRedemptions**](RedemptionRelatedRedemptions.md) | | [optional] +**failure_code** | **str** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failure_message** | **str** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**RedemptionChannel**](RedemptionChannel.md) | | [optional] +**customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] +**related_object_type** | **str** | Defines the related object. | [optional] +**related_object_id** | **str** | Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher. | [optional] +**voucher** | [**RedemptionVoucher**](RedemptionVoucher.md) | | [optional] +**promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**RedemptionGift**](RedemptionGift.md) | | [optional] +**loyalty_card** | [**RedemptionLoyaltyCard**](RedemptionLoyaltyCard.md) | | [optional] + +[[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/RedemptionChannel.md b/docs/RedemptionChannel.md new file mode 100644 index 00000000..2864120e --- /dev/null +++ b/docs/RedemptionChannel.md @@ -0,0 +1,14 @@ +# RedemptionChannel + +Defines the details of the channel through which the redemption was issued. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel_id** | **str** | Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channel_type** | **str** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[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/RedemptionEntry.md b/docs/RedemptionEntry.md new file mode 100644 index 00000000..3a951adf --- /dev/null +++ b/docs/RedemptionEntry.md @@ -0,0 +1,35 @@ +# RedemptionEntry + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**object** | **str** | | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the redeeming customer. | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**metadata** | **object** | | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **str** | Unique redemption ID of the parent redemption. | [optional] +**result** | **str** | Redemption result. | [optional] +**status** | **str** | | [optional] +**related_redemptions** | [**RedemptionEntryRelatedRedemptions**](RedemptionEntryRelatedRedemptions.md) | | [optional] +**failure_code** | **str** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failure_message** | **str** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**RedemptionEntryOrder**](RedemptionEntryOrder.md) | | [optional] +**channel** | [**RedemptionEntryChannel**](RedemptionEntryChannel.md) | | [optional] +**customer** | [**RedemptionEntryCustomer**](RedemptionEntryCustomer.md) | | [optional] +**related_object_type** | **str** | Defines the related object. | [optional] +**related_object_id** | **str** | | [optional] +**voucher** | [**RedemptionEntryVoucher**](RedemptionEntryVoucher.md) | | [optional] +**promotion_tier** | [**RedemptionEntryPromotionTier**](RedemptionEntryPromotionTier.md) | | [optional] +**reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**RedemptionEntryGift**](RedemptionEntryGift.md) | | [optional] +**loyalty_card** | [**RedemptionEntryLoyaltyCard**](RedemptionEntryLoyaltyCard.md) | | [optional] +**reason** | **str** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] + +[[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/RedemptionEntryChannel.md b/docs/RedemptionEntryChannel.md new file mode 100644 index 00000000..717537f0 --- /dev/null +++ b/docs/RedemptionEntryChannel.md @@ -0,0 +1,13 @@ +# RedemptionEntryChannel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel_id** | **str** | | [optional] +**channel_type** | **str** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[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/RedemptionEntryCustomer.md b/docs/RedemptionEntryCustomer.md new file mode 100644 index 00000000..db1c5c3d --- /dev/null +++ b/docs/RedemptionEntryCustomer.md @@ -0,0 +1,17 @@ +# RedemptionEntryCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**email** | **str** | Customer's email address. | [optional] +**source_id** | **str** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionEntryGift.md b/docs/RedemptionEntryGift.md new file mode 100644 index 00000000..36f9ab85 --- /dev/null +++ b/docs/RedemptionEntryGift.md @@ -0,0 +1,12 @@ +# RedemptionEntryGift + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[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/RedemptionEntryLoyaltyCard.md b/docs/RedemptionEntryLoyaltyCard.md new file mode 100644 index 00000000..46c03e2b --- /dev/null +++ b/docs/RedemptionEntryLoyaltyCard.md @@ -0,0 +1,12 @@ +# RedemptionEntryLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[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/RedemptionEntryOrder.md b/docs/RedemptionEntryOrder.md new file mode 100644 index 00000000..71f41189 --- /dev/null +++ b/docs/RedemptionEntryOrder.md @@ -0,0 +1,33 @@ +# RedemptionEntryOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**List[OrderCalculatedItem]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**RedemptionEntryOrderCustomer**](RedemptionEntryOrderCustomer.md) | | [optional] +**referrer** | [**RedemptionEntryOrderReferrer**](RedemptionEntryOrderReferrer.md) | | [optional] +**redemptions** | **object** | | [optional] + +[[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/RedemptionEntryOrderCustomer.md b/docs/RedemptionEntryOrderCustomer.md new file mode 100644 index 00000000..ffbbcf57 --- /dev/null +++ b/docs/RedemptionEntryOrderCustomer.md @@ -0,0 +1,13 @@ +# RedemptionEntryOrderCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionEntryOrderReferrer.md b/docs/RedemptionEntryOrderReferrer.md new file mode 100644 index 00000000..ca42b923 --- /dev/null +++ b/docs/RedemptionEntryOrderReferrer.md @@ -0,0 +1,13 @@ +# RedemptionEntryOrderReferrer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionEntryPromotionTier.md b/docs/RedemptionEntryPromotionTier.md new file mode 100644 index 00000000..de8bca93 --- /dev/null +++ b/docs/RedemptionEntryPromotionTier.md @@ -0,0 +1,33 @@ +# RedemptionEntryPromotionTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**RedemptionEntryPromotionTierAction**](RedemptionEntryPromotionTierAction.md) | | [optional] +**metadata** | **object** | | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**RedemptionEntryPromotionTierCampaign**](RedemptionEntryPromotionTierCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**RedemptionEntryPromotionTierSummary**](RedemptionEntryPromotionTierSummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/RedemptionEntryPromotionTierAction.md b/docs/RedemptionEntryPromotionTierAction.md new file mode 100644 index 00000000..f4df966a --- /dev/null +++ b/docs/RedemptionEntryPromotionTierAction.md @@ -0,0 +1,12 @@ +# RedemptionEntryPromotionTierAction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/RedemptionEntryPromotionTierCampaign.md b/docs/RedemptionEntryPromotionTierCampaign.md new file mode 100644 index 00000000..dd6b4d4b --- /dev/null +++ b/docs/RedemptionEntryPromotionTierCampaign.md @@ -0,0 +1,20 @@ +# RedemptionEntryPromotionTierCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/RedemptionEntryPromotionTierSummary.md b/docs/RedemptionEntryPromotionTierSummary.md new file mode 100644 index 00000000..954510cf --- /dev/null +++ b/docs/RedemptionEntryPromotionTierSummary.md @@ -0,0 +1,13 @@ +# RedemptionEntryPromotionTierSummary + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**RedemptionEntryPromotionTierSummaryRedemptions**](RedemptionEntryPromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**RedemptionEntryPromotionTierSummaryOrders**](RedemptionEntryPromotionTierSummaryOrders.md) | | [optional] + +[[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/RedemptionEntryPromotionTierSummaryOrders.md b/docs/RedemptionEntryPromotionTierSummaryOrders.md new file mode 100644 index 00000000..6b12bc85 --- /dev/null +++ b/docs/RedemptionEntryPromotionTierSummaryOrders.md @@ -0,0 +1,13 @@ +# RedemptionEntryPromotionTierSummaryOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/RedemptionEntryPromotionTierSummaryRedemptions.md b/docs/RedemptionEntryPromotionTierSummaryRedemptions.md new file mode 100644 index 00000000..a983a0fd --- /dev/null +++ b/docs/RedemptionEntryPromotionTierSummaryRedemptions.md @@ -0,0 +1,12 @@ +# RedemptionEntryPromotionTierSummaryRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/RedemptionEntryRelatedRedemptions.md b/docs/RedemptionEntryRelatedRedemptions.md new file mode 100644 index 00000000..d8dd1883 --- /dev/null +++ b/docs/RedemptionEntryRelatedRedemptions.md @@ -0,0 +1,13 @@ +# RedemptionEntryRelatedRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[RedemptionEntryRelatedRedemptionsRollbacksItem]**](RedemptionEntryRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**List[RedemptionEntryRelatedRedemptionsRedemptionsItem]**](RedemptionEntryRelatedRedemptionsRedemptionsItem.md) | | [optional] + +[[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/RedemptionEntryRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionEntryRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..fd370d2c --- /dev/null +++ b/docs/RedemptionEntryRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,13 @@ +# RedemptionEntryRelatedRedemptionsRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionEntryRelatedRedemptionsRollbacksItem.md b/docs/RedemptionEntryRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..6bc91e8e --- /dev/null +++ b/docs/RedemptionEntryRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,13 @@ +# RedemptionEntryRelatedRedemptionsRollbacksItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionEntryVoucher.md b/docs/RedemptionEntryVoucher.md new file mode 100644 index 00000000..37bbfbe9 --- /dev/null +++ b/docs/RedemptionEntryVoucher.md @@ -0,0 +1,41 @@ +# RedemptionEntryVoucher + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**RedemptionEntryVoucherGift**](RedemptionEntryVoucherGift.md) | | [optional] +**loyalty_card** | [**RedemptionEntryVoucherLoyaltyCard**](RedemptionEntryVoucherLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**RedemptionEntryVoucherPublish**](RedemptionEntryVoucherPublish.md) | | [optional] +**redemption** | [**RedemptionEntryVoucherRedemption**](RedemptionEntryVoucherRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] + +[[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/RedemptionEntryVoucherGift.md b/docs/RedemptionEntryVoucherGift.md new file mode 100644 index 00000000..d0e61d55 --- /dev/null +++ b/docs/RedemptionEntryVoucherGift.md @@ -0,0 +1,14 @@ +# RedemptionEntryVoucherGift + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/RedemptionEntryVoucherLoyaltyCard.md b/docs/RedemptionEntryVoucherLoyaltyCard.md new file mode 100644 index 00000000..ac1eff45 --- /dev/null +++ b/docs/RedemptionEntryVoucherLoyaltyCard.md @@ -0,0 +1,15 @@ +# RedemptionEntryVoucherLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/RedemptionEntryVoucherPublish.md b/docs/RedemptionEntryVoucherPublish.md new file mode 100644 index 00000000..c0a346d5 --- /dev/null +++ b/docs/RedemptionEntryVoucherPublish.md @@ -0,0 +1,14 @@ +# RedemptionEntryVoucherPublish + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/RedemptionEntryVoucherRedemption.md b/docs/RedemptionEntryVoucherRedemption.md new file mode 100644 index 00000000..f4adbfd2 --- /dev/null +++ b/docs/RedemptionEntryVoucherRedemption.md @@ -0,0 +1,16 @@ +# RedemptionEntryVoucherRedemption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/RedemptionGift.md b/docs/RedemptionGift.md new file mode 100644 index 00000000..d902f5be --- /dev/null +++ b/docs/RedemptionGift.md @@ -0,0 +1,13 @@ +# RedemptionGift + +Contains the amount subtracted from the gift card for the redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/RedemptionLoyaltyCard.md b/docs/RedemptionLoyaltyCard.md new file mode 100644 index 00000000..d0d63806 --- /dev/null +++ b/docs/RedemptionLoyaltyCard.md @@ -0,0 +1,13 @@ +# RedemptionLoyaltyCard + +Contains the number of points subtracted from the loyalty card for the redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. | [optional] + +[[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/RedemptionRelatedRedemptions.md b/docs/RedemptionRelatedRedemptions.md new file mode 100644 index 00000000..57d20d43 --- /dev/null +++ b/docs/RedemptionRelatedRedemptions.md @@ -0,0 +1,13 @@ +# RedemptionRelatedRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[RedemptionRelatedRedemptionsRollbacksItem]**](RedemptionRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**List[RedemptionRelatedRedemptionsRedemptionsItem]**](RedemptionRelatedRedemptionsRedemptionsItem.md) | | [optional] + +[[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/RedemptionRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..94fa30fc --- /dev/null +++ b/docs/RedemptionRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,13 @@ +# RedemptionRelatedRedemptionsRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionRelatedRedemptionsRollbacksItem.md b/docs/RedemptionRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..dec01656 --- /dev/null +++ b/docs/RedemptionRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,13 @@ +# RedemptionRelatedRedemptionsRollbacksItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique rollback redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionRewardResult.md b/docs/RedemptionRewardResult.md new file mode 100644 index 00000000..80e7626f --- /dev/null +++ b/docs/RedemptionRewardResult.md @@ -0,0 +1,25 @@ +# RedemptionRewardResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] +**assignment_id** | **str** | Unique reward assignment ID assigned by Voucherify. | [optional] +**voucher** | [**Voucher**](Voucher.md) | | [optional] +**product** | [**Product**](Product.md) | | [optional] +**sku** | [**Sku**](Sku.md) | | [optional] +**loyalty_tier_id** | **str** | Unique loyalty tier ID assigned by Voucherify. | [optional] +**id** | **str** | Unique reward ID. | [optional] +**name** | **str** | Name of the reward. | [optional] +**object** | **str** | The type of the object represented by the JSON | [optional] [default to 'reward'] +**created_at** | **datetime** | Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp in ISO 8601 format indicating when the reward was updated. | [optional] +**parameters** | [**RedemptionRewardResultParameters**](RedemptionRewardResultParameters.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a reward. The metadata object stores all custom attributes assigned to the reward. | [optional] +**type** | **str** | Reward type. | [optional] + +[[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/RedemptionRewardResultParameters.md b/docs/RedemptionRewardResultParameters.md new file mode 100644 index 00000000..1d0b376c --- /dev/null +++ b/docs/RedemptionRewardResultParameters.md @@ -0,0 +1,15 @@ +# RedemptionRewardResultParameters + +These are parameters representing a material reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**RedemptionRewardResultParametersCampaign**](RedemptionRewardResultParametersCampaign.md) | | [optional] +**product** | [**RedemptionRewardResultParametersProduct**](RedemptionRewardResultParametersProduct.md) | | [optional] +**coin** | [**RedemptionRewardResultParametersCoin**](RedemptionRewardResultParametersCoin.md) | | [optional] + +[[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/RedemptionRewardResultParametersCampaign.md b/docs/RedemptionRewardResultParametersCampaign.md new file mode 100644 index 00000000..965c5df4 --- /dev/null +++ b/docs/RedemptionRewardResultParametersCampaign.md @@ -0,0 +1,15 @@ +# RedemptionRewardResultParametersCampaign + +Defines the product redeemed as a reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Campaign unique ID. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**type** | **str** | Defines the type of the campaign. | [optional] + +[[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/RedemptionRewardResultParametersCoin.md b/docs/RedemptionRewardResultParametersCoin.md new file mode 100644 index 00000000..6fafb1df --- /dev/null +++ b/docs/RedemptionRewardResultParametersCoin.md @@ -0,0 +1,14 @@ +# RedemptionRewardResultParametersCoin + +Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchange_ratio** | **int** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] +**points_ratio** | **int** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] + +[[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/RedemptionRewardResultParametersProduct.md b/docs/RedemptionRewardResultParametersProduct.md new file mode 100644 index 00000000..375fb13d --- /dev/null +++ b/docs/RedemptionRewardResultParametersProduct.md @@ -0,0 +1,14 @@ +# RedemptionRewardResultParametersProduct + +Defines the product redeemed as a reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID, assigned by Voucherify. | [optional] +**sku_id** | **str** | Unique identifier of the SKU. It is assigned by Voucherify. | [optional] + +[[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/RedemptionRollback.md b/docs/RedemptionRollback.md new file mode 100644 index 00000000..47dd72ca --- /dev/null +++ b/docs/RedemptionRollback.md @@ -0,0 +1,36 @@ +# RedemptionRollback + +This is an object representing a redemption rollback. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the redemption rollback. | [optional] +**object** | **str** | The type of the object represented by the JSON | [optional] [default to 'redemption_rollback'] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the redeeming customer. | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **str** | Unique redemption ID of the parent redemption. | [optional] +**reason** | **str** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] +**result** | **str** | Redemption result. | [optional] +**status** | **str** | Redemption status. | [optional] +**related_redemptions** | [**RedemptionRollbackRelatedRedemptions**](RedemptionRollbackRelatedRedemptions.md) | | [optional] +**failure_code** | **str** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failure_message** | **str** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**RedemptionRollbackChannel**](RedemptionRollbackChannel.md) | | [optional] +**customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] +**related_object_type** | **str** | Defines the related object. | [optional] +**related_object_id** | **str** | Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] +**voucher** | [**Voucher**](Voucher.md) | | [optional] +**promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**RedemptionRollbackGift**](RedemptionRollbackGift.md) | | [optional] +**loyalty_card** | [**RedemptionRollbackLoyaltyCard**](RedemptionRollbackLoyaltyCard.md) | | [optional] + +[[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/RedemptionRollbackChannel.md b/docs/RedemptionRollbackChannel.md new file mode 100644 index 00000000..23368d5a --- /dev/null +++ b/docs/RedemptionRollbackChannel.md @@ -0,0 +1,14 @@ +# RedemptionRollbackChannel + +Defines the details of the channel through which the redemption was issued. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel_id** | **str** | Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channel_type** | **str** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[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/RedemptionRollbackGift.md b/docs/RedemptionRollbackGift.md new file mode 100644 index 00000000..30b180dc --- /dev/null +++ b/docs/RedemptionRollbackGift.md @@ -0,0 +1,13 @@ +# RedemptionRollbackGift + +Contains the amount returned to the gift card in the redemption rollback. It is expressed as a negative integer. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[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/RedemptionRollbackLoyaltyCard.md b/docs/RedemptionRollbackLoyaltyCard.md new file mode 100644 index 00000000..588b32e9 --- /dev/null +++ b/docs/RedemptionRollbackLoyaltyCard.md @@ -0,0 +1,13 @@ +# RedemptionRollbackLoyaltyCard + +Contains the number of points returned to the loyalty card in the reward redemption rollback. It is expressed as a negative integer. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[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/RedemptionRollbackRelatedRedemptions.md b/docs/RedemptionRollbackRelatedRedemptions.md new file mode 100644 index 00000000..0c519e2e --- /dev/null +++ b/docs/RedemptionRollbackRelatedRedemptions.md @@ -0,0 +1,13 @@ +# RedemptionRollbackRelatedRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[RedemptionRollbackRelatedRedemptionsRollbacksItem]**](RedemptionRollbackRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**List[RedemptionRollbackRelatedRedemptionsRedemptionsItem]**](RedemptionRollbackRelatedRedemptionsRedemptionsItem.md) | | [optional] + +[[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/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..8f254b23 --- /dev/null +++ b/docs/RedemptionRollbackRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,13 @@ +# RedemptionRollbackRelatedRedemptionsRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionRollbackRelatedRedemptionsRollbacksItem.md b/docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..ded0771c --- /dev/null +++ b/docs/RedemptionRollbackRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,13 @@ +# RedemptionRollbackRelatedRedemptionsRollbacksItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the redemption rollback. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionVoucher.md b/docs/RedemptionVoucher.md new file mode 100644 index 00000000..433b3e82 --- /dev/null +++ b/docs/RedemptionVoucher.md @@ -0,0 +1,42 @@ +# RedemptionVoucher + +Defines the details of the voucher being redeemed. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**RedemptionVoucherGift**](RedemptionVoucherGift.md) | | [optional] +**loyalty_card** | [**RedemptionVoucherLoyaltyCard**](RedemptionVoucherLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**RedemptionVoucherPublish**](RedemptionVoucherPublish.md) | | [optional] +**redemption** | [**RedemptionVoucherRedemption**](RedemptionVoucherRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] + +[[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/RedemptionVoucherGift.md b/docs/RedemptionVoucherGift.md new file mode 100644 index 00000000..802fd0af --- /dev/null +++ b/docs/RedemptionVoucherGift.md @@ -0,0 +1,15 @@ +# RedemptionVoucherGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/RedemptionVoucherLoyaltyCard.md b/docs/RedemptionVoucherLoyaltyCard.md new file mode 100644 index 00000000..a306ed26 --- /dev/null +++ b/docs/RedemptionVoucherLoyaltyCard.md @@ -0,0 +1,16 @@ +# RedemptionVoucherLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/RedemptionVoucherPublish.md b/docs/RedemptionVoucherPublish.md new file mode 100644 index 00000000..00cf0d41 --- /dev/null +++ b/docs/RedemptionVoucherPublish.md @@ -0,0 +1,15 @@ +# RedemptionVoucherPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/RedemptionVoucherRedemption.md b/docs/RedemptionVoucherRedemption.md new file mode 100644 index 00000000..6e958bcd --- /dev/null +++ b/docs/RedemptionVoucherRedemption.md @@ -0,0 +1,17 @@ +# RedemptionVoucherRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/RedemptionsApi.md b/docs/RedemptionsApi.md new file mode 100644 index 00000000..81d7b154 --- /dev/null +++ b/docs/RedemptionsApi.md @@ -0,0 +1,562 @@ +# voucherify.RedemptionsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_redemption**](RedemptionsApi.md#get_redemption) | **GET** /v1/redemptions/{redemptionId} | Get Redemption +[**get_voucher_redemptions**](RedemptionsApi.md#get_voucher_redemptions) | **GET** /v1/vouchers/{code}/redemption | Get Voucher's Redemptions +[**list_redemptions**](RedemptionsApi.md#list_redemptions) | **GET** /v1/redemptions | List Redemptions +[**redeem_stacked_discounts**](RedemptionsApi.md#redeem_stacked_discounts) | **POST** /v1/redemptions | Redeem Stackable Discounts +[**rollback_redemption**](RedemptionsApi.md#rollback_redemption) | **POST** /v1/redemptions/{redemptionId}/rollback | Rollback Redemption +[**rollback_stacked_redemptions**](RedemptionsApi.md#rollback_stacked_redemptions) | **POST** /v1/redemptions/{parentRedemptionId}/rollbacks | Rollback Stackable Redemptions + + +# **get_redemption** +> RedemptionsGetResponseBody get_redemption(redemption_id) + +Get Redemption + +Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.redemptions_get_response_body import RedemptionsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RedemptionsApi(api_client) + redemption_id = 'redemption_id_example' # str | ID of previously created redemption. + + try: + # Get Redemption + api_response = api_instance.get_redemption(redemption_id) + print("The response of RedemptionsApi->get_redemption:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RedemptionsApi->get_redemption: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **redemption_id** | **str**| ID of previously created redemption. | + +### Return type + +[**RedemptionsGetResponseBody**](RedemptionsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a redemption object. | - | + +[[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) + +# **get_voucher_redemptions** +> VouchersRedemptionGetResponseBody get_voucher_redemptions(code) + +Get Voucher's Redemptions + +Retrieve the number of times a voucher was redeemed and each of the redemption details. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_redemption_get_response_body import VouchersRedemptionGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RedemptionsApi(api_client) + code = 'code_example' # str | A **code** that identifies the voucher. + + try: + # Get Voucher's Redemptions + api_response = api_instance.get_voucher_redemptions(code) + print("The response of RedemptionsApi->get_voucher_redemptions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RedemptionsApi->get_voucher_redemptions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A **code** that identifies the voucher. | + +### Return type + +[**VouchersRedemptionGetResponseBody**](VouchersRedemptionGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | A dictionary with a `redemption_entries` property that contains an array of voucher's redemptions. | - | + +[[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) + +# **list_redemptions** +> RedemptionsListResponseBody list_redemptions(limit=limit, page=page, result=result, campaign=campaign, customer=customer, order=order, created_at=created_at, filters=filters) + +List Redemptions + +Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. # Filtering results The result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date: https://api.voucherify.io/v1/redemptions?limit 3&[created_at][before] 2017-09-08T13:52:18.227Z. A filter based on the object created_at field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: [created_at][after], [created_at][before]. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z. # Failed Redemptions A redemption may fail for various reasons. You can figure out an exact reason from the failure_code: - resource_not_found - voucher with given code does not exist - voucher_not_active - voucher is not active yet (before start date) - voucher_expired - voucher has already expired (after expiration date) - voucher_disabled - voucher has been disabled (active: false) - quantity_exceeded - vouchers redemptions limit has been exceeded - gift_amount_exceeded - gift amount has been exceeded - customer_rules_violated - customer did not match the segment - order_rules_violated - order did not match validation rules - invalid_order - order was specified incorrectly - invalid_amount - order amount was specified incorrectly - missing_amount - order amount was not specified - missing_order_items - order items were not specified - missing_customer - customer was not specified + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_filters_list_redemptions import ParameterFiltersListRedemptions +from voucherify.models.parameter_order_list_redemptions import ParameterOrderListRedemptions +from voucherify.models.redemptions_list_response_body import RedemptionsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RedemptionsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + result = 'result_example' # str | A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. (optional) + campaign = 'campaign_example' # str | A filter by the campaign **name** that the redemption resources originate from. (optional) + customer = 'customer_example' # str | Return redemptions performed by the customer with given id or source_id. (optional) + order = voucherify.ParameterOrderListRedemptions() # ParameterOrderListRedemptions | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + created_at = voucherify.ParameterCreatedBeforeAfter() # ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + filters = voucherify.ParameterFiltersListRedemptions() # ParameterFiltersListRedemptions | Filters for listing responses. (optional) + + try: + # List Redemptions + api_response = api_instance.list_redemptions(limit=limit, page=page, result=result, campaign=campaign, customer=customer, order=order, created_at=created_at, filters=filters) + print("The response of RedemptionsApi->list_redemptions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RedemptionsApi->list_redemptions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **result** | **str**| A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. | [optional] + **campaign** | **str**| A filter by the campaign **name** that the redemption resources originate from. | [optional] + **customer** | **str**| Return redemptions performed by the customer with given id or source_id. | [optional] + **order** | [**ParameterOrderListRedemptions**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **created_at** | [**ParameterCreatedBeforeAfter**](.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] + **filters** | [**ParameterFiltersListRedemptions**](.md)| Filters for listing responses. | [optional] + +### Return type + +[**RedemptionsListResponseBody**](RedemptionsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a list of redemption objects. Each entry in the array is a separate redemption object. If no more redemptions are available, the resulting array will be empty. If you provide a non-existent customer ID, this call returns an empty object. | - | + +[[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) + +# **redeem_stacked_discounts** +> RedemptionsRedeemResponseBody redeem_stacked_discounts(redemptions_redeem_request_body=redemptions_redeem_request_body) + +Redeem Stackable Discounts + +# How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. ๐Ÿ“˜ Also available on client-side This method is also accessible through public keys which you can use in client-sideโ€‹ apps: mobile and web browser apps. Go to the dedicated endpoint to learn more. - Use X-Client-Application-Id as the application ID header. - Use X-Client-Token as the appliction secret key header. - Use client-side base URL. - Use an origin header for your custom domain. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.redemptions_redeem_request_body import RedemptionsRedeemRequestBody +from voucherify.models.redemptions_redeem_response_body import RedemptionsRedeemResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RedemptionsApi(api_client) + redemptions_redeem_request_body = {"customer":{"source_id":"sample_customer","metadata":{"key":"value"}},"options":{"expand":["order","redeemable","category"]},"redeemables":[{"object":"voucher","id":"voucher-code"}],"session":{"type":"LOCK","key":"session_key"},"order":{"amount":55000,"status":"PAID","items":[{"quantity":2,"price":20000,"source_id":"sample product1","related_object":"product","product":{"metadata":{"key":"value"}}},{"quantity":1,"price":15000,"source_id":"sample product2","related_object":"product","product":{"metadata":{"key":"value"}}}],"metadata":{"key":"value"}}} # RedemptionsRedeemRequestBody | (optional) + + try: + # Redeem Stackable Discounts + api_response = api_instance.redeem_stacked_discounts(redemptions_redeem_request_body=redemptions_redeem_request_body) + print("The response of RedemptionsApi->redeem_stacked_discounts:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RedemptionsApi->redeem_stacked_discounts: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **redemptions_redeem_request_body** | [**RedemptionsRedeemRequestBody**](RedemptionsRedeemRequestBody.md)| | [optional] + +### Return type + +[**RedemptionsRedeemResponseBody**](RedemptionsRedeemResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Depending on your project settings: all redeemables must be valid or just one must be valid to result as valid redemption. See https://support.voucherify.io/article/604-stacking-rules#application-rules | - | + +[[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) + +# **rollback_redemption** +> RedemptionsRollbackCreateResponseBody rollback_redemption(redemption_id, reason=reason, tracking_id=tracking_id, redemptions_rollback_create_request_body=redemptions_rollback_create_request_body) + +Rollback Redemption + +Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. ๐Ÿšง You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.redemptions_rollback_create_request_body import RedemptionsRollbackCreateRequestBody +from voucherify.models.redemptions_rollback_create_response_body import RedemptionsRollbackCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RedemptionsApi(api_client) + redemption_id = 'redemption_id_example' # str | The original redemption ID to be rolled back (undone). + reason = 'reason_example' # str | Reason for the rollback. (optional) + tracking_id = 'tracking_id_example' # str | Customers source_id. (optional) + redemptions_rollback_create_request_body = {"customer":{"id":"cust_SolpIN5N4oZbCnrxZ5NHrbVB","name":"Annie Lemons","email":"annie@lemon.com","phone":"+1 933 222 3334","birthday":"1900-12-02","birthdate":"1900-12-01","address":{"city":"New York","state":"NY","line_1":"123 Main St.","line_2":"APT 3 BLG 5","country":"United States","postal_code":"100012"},"metadata":{"age":23}},"order":{"source_id":"test_rollback_8"},"metadata":{"location_id":["L2"]}} # RedemptionsRollbackCreateRequestBody | Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + + try: + # Rollback Redemption + api_response = api_instance.rollback_redemption(redemption_id, reason=reason, tracking_id=tracking_id, redemptions_rollback_create_request_body=redemptions_rollback_create_request_body) + print("The response of RedemptionsApi->rollback_redemption:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RedemptionsApi->rollback_redemption: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **redemption_id** | **str**| The original redemption ID to be rolled back (undone). | + **reason** | **str**| Reason for the rollback. | [optional] + **tracking_id** | **str**| Customers source_id. | [optional] + **redemptions_rollback_create_request_body** | [**RedemptionsRollbackCreateRequestBody**](RedemptionsRollbackCreateRequestBody.md)| Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. | [optional] + +### Return type + +[**RedemptionsRollbackCreateResponseBody**](RedemptionsRollbackCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a redemption rollback object indicating the result of the rollback. | - | + +[[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) + +# **rollback_stacked_redemptions** +> RedemptionsRollbacksCreateResponseBody rollback_stacked_redemptions(parent_redemption_id, reason=reason, tracking_id=tracking_id, redemptions_rollbacks_create_request_body=redemptions_rollbacks_create_request_body) + +Rollback Stackable Redemptions + +Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. ๐Ÿšง You can roll back a redemption up to 3 months back. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.redemptions_rollbacks_create_request_body import RedemptionsRollbacksCreateRequestBody +from voucherify.models.redemptions_rollbacks_create_response_body import RedemptionsRollbacksCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RedemptionsApi(api_client) + parent_redemption_id = 'parent_redemption_id_example' # str | Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. + reason = 'reason_example' # str | Reason for the rollback. (optional) + tracking_id = 'tracking_id_example' # str | Customers source_id. (optional) + redemptions_rollbacks_create_request_body = {"customer":{"id":"cust_SolpIN5N4oZbCnrxZ5NHrbVB","name":"Annie Lemons","email":"annie@lemon.com","phone":"+1 933 222 3334","birthday":"1900-12-02","birthdate":"1900-12-01","address":{"city":"New York","state":"NY","line_1":"123 Main St.","line_2":"APT 3 BLG 5","country":"United States","postal_code":"100012"},"metadata":{"age":23}},"order":{"source_id":"test_rollback_8"},"metadata":{"location_id":["L2"]}} # RedemptionsRollbacksCreateRequestBody | Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. (optional) + + try: + # Rollback Stackable Redemptions + api_response = api_instance.rollback_stacked_redemptions(parent_redemption_id, reason=reason, tracking_id=tracking_id, redemptions_rollbacks_create_request_body=redemptions_rollbacks_create_request_body) + print("The response of RedemptionsApi->rollback_stacked_redemptions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RedemptionsApi->rollback_stacked_redemptions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **parent_redemption_id** | **str**| Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. | + **reason** | **str**| Reason for the rollback. | [optional] + **tracking_id** | **str**| Customers source_id. | [optional] + **redemptions_rollbacks_create_request_body** | [**RedemptionsRollbacksCreateRequestBody**](RedemptionsRollbacksCreateRequestBody.md)| Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. | [optional] + +### Return type + +[**RedemptionsRollbacksCreateResponseBody**](RedemptionsRollbacksCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an array with the individual redemption rollback results along with the parent rollback result and related order. | - | + +[[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) + diff --git a/docs/RedemptionsGetResponseBody.md b/docs/RedemptionsGetResponseBody.md new file mode 100644 index 00000000..0eac2b61 --- /dev/null +++ b/docs/RedemptionsGetResponseBody.md @@ -0,0 +1,35 @@ +# RedemptionsGetResponseBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**object** | **str** | | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the redeeming customer. | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**metadata** | **object** | | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **str** | Unique redemption ID of the parent redemption. | [optional] +**result** | **str** | Redemption result. | [optional] +**status** | **str** | | [optional] +**related_redemptions** | [**RedemptionsGetResponseBodyRelatedRedemptions**](RedemptionsGetResponseBodyRelatedRedemptions.md) | | [optional] +**failure_code** | **str** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failure_message** | **str** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**RedemptionsGetResponseBodyOrder**](RedemptionsGetResponseBodyOrder.md) | | [optional] +**channel** | [**RedemptionsGetResponseBodyChannel**](RedemptionsGetResponseBodyChannel.md) | | [optional] +**customer** | [**RedemptionsGetResponseBodyCustomer**](RedemptionsGetResponseBodyCustomer.md) | | [optional] +**related_object_type** | **str** | Defines the related object. | [optional] +**related_object_id** | **str** | | [optional] +**voucher** | [**RedemptionsGetResponseBodyVoucher**](RedemptionsGetResponseBodyVoucher.md) | | [optional] +**promotion_tier** | [**RedemptionsGetResponseBodyPromotionTier**](RedemptionsGetResponseBodyPromotionTier.md) | | [optional] +**reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**RedemptionsGetResponseBodyGift**](RedemptionsGetResponseBodyGift.md) | | [optional] +**loyalty_card** | [**RedemptionsGetResponseBodyLoyaltyCard**](RedemptionsGetResponseBodyLoyaltyCard.md) | | [optional] +**reason** | **str** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] + +[[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/RedemptionsGetResponseBodyChannel.md b/docs/RedemptionsGetResponseBodyChannel.md new file mode 100644 index 00000000..48d84681 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyChannel.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyChannel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel_id** | **str** | | [optional] +**channel_type** | **str** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[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/RedemptionsGetResponseBodyCustomer.md b/docs/RedemptionsGetResponseBodyCustomer.md new file mode 100644 index 00000000..8f0c735f --- /dev/null +++ b/docs/RedemptionsGetResponseBodyCustomer.md @@ -0,0 +1,17 @@ +# RedemptionsGetResponseBodyCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**email** | **str** | Customer's email address. | [optional] +**source_id** | **str** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionsGetResponseBodyGift.md b/docs/RedemptionsGetResponseBodyGift.md new file mode 100644 index 00000000..9289d5db --- /dev/null +++ b/docs/RedemptionsGetResponseBodyGift.md @@ -0,0 +1,12 @@ +# RedemptionsGetResponseBodyGift + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[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/RedemptionsGetResponseBodyLoyaltyCard.md b/docs/RedemptionsGetResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..8c726303 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyLoyaltyCard.md @@ -0,0 +1,12 @@ +# RedemptionsGetResponseBodyLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[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/RedemptionsGetResponseBodyOrder.md b/docs/RedemptionsGetResponseBodyOrder.md new file mode 100644 index 00000000..5998d154 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyOrder.md @@ -0,0 +1,33 @@ +# RedemptionsGetResponseBodyOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**List[OrderCalculatedItem]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**RedemptionsGetResponseBodyOrderCustomer**](RedemptionsGetResponseBodyOrderCustomer.md) | | [optional] +**referrer** | [**RedemptionsGetResponseBodyOrderReferrer**](RedemptionsGetResponseBodyOrderReferrer.md) | | [optional] +**redemptions** | **object** | | [optional] + +[[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/RedemptionsGetResponseBodyOrderCustomer.md b/docs/RedemptionsGetResponseBodyOrderCustomer.md new file mode 100644 index 00000000..e505d1e8 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyOrderCustomer.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyOrderCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionsGetResponseBodyOrderReferrer.md b/docs/RedemptionsGetResponseBodyOrderReferrer.md new file mode 100644 index 00000000..857b246a --- /dev/null +++ b/docs/RedemptionsGetResponseBodyOrderReferrer.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyOrderReferrer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionsGetResponseBodyPromotionTier.md b/docs/RedemptionsGetResponseBodyPromotionTier.md new file mode 100644 index 00000000..62838106 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTier.md @@ -0,0 +1,33 @@ +# RedemptionsGetResponseBodyPromotionTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**RedemptionsGetResponseBodyPromotionTierAction**](RedemptionsGetResponseBodyPromotionTierAction.md) | | [optional] +**metadata** | **object** | | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**RedemptionsGetResponseBodyPromotionTierCampaign**](RedemptionsGetResponseBodyPromotionTierCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**RedemptionsGetResponseBodyPromotionTierSummary**](RedemptionsGetResponseBodyPromotionTierSummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/RedemptionsGetResponseBodyPromotionTierAction.md b/docs/RedemptionsGetResponseBodyPromotionTierAction.md new file mode 100644 index 00000000..00798643 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierAction.md @@ -0,0 +1,12 @@ +# RedemptionsGetResponseBodyPromotionTierAction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/RedemptionsGetResponseBodyPromotionTierCampaign.md b/docs/RedemptionsGetResponseBodyPromotionTierCampaign.md new file mode 100644 index 00000000..2883bcf7 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierCampaign.md @@ -0,0 +1,20 @@ +# RedemptionsGetResponseBodyPromotionTierCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/RedemptionsGetResponseBodyPromotionTierSummary.md b/docs/RedemptionsGetResponseBodyPromotionTierSummary.md new file mode 100644 index 00000000..49ed1aec --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierSummary.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyPromotionTierSummary + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**RedemptionsGetResponseBodyPromotionTierSummaryRedemptions**](RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**RedemptionsGetResponseBodyPromotionTierSummaryOrders**](RedemptionsGetResponseBodyPromotionTierSummaryOrders.md) | | [optional] + +[[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/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md b/docs/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md new file mode 100644 index 00000000..c0f900a1 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierSummaryOrders.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyPromotionTierSummaryOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md b/docs/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md new file mode 100644 index 00000000..12978f71 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.md @@ -0,0 +1,12 @@ +# RedemptionsGetResponseBodyPromotionTierSummaryRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/RedemptionsGetResponseBodyRelatedRedemptions.md b/docs/RedemptionsGetResponseBodyRelatedRedemptions.md new file mode 100644 index 00000000..fcab1caa --- /dev/null +++ b/docs/RedemptionsGetResponseBodyRelatedRedemptions.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyRelatedRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem]**](RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**List[RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem]**](RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md) | | [optional] + +[[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/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..62703de9 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..79d18655 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,13 @@ +# RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionsGetResponseBodyVoucher.md b/docs/RedemptionsGetResponseBodyVoucher.md new file mode 100644 index 00000000..d8fd113b --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucher.md @@ -0,0 +1,41 @@ +# RedemptionsGetResponseBodyVoucher + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**RedemptionsGetResponseBodyVoucherGift**](RedemptionsGetResponseBodyVoucherGift.md) | | [optional] +**loyalty_card** | [**RedemptionsGetResponseBodyVoucherLoyaltyCard**](RedemptionsGetResponseBodyVoucherLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**RedemptionsGetResponseBodyVoucherPublish**](RedemptionsGetResponseBodyVoucherPublish.md) | | [optional] +**redemption** | [**RedemptionsGetResponseBodyVoucherRedemption**](RedemptionsGetResponseBodyVoucherRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] + +[[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/RedemptionsGetResponseBodyVoucherGift.md b/docs/RedemptionsGetResponseBodyVoucherGift.md new file mode 100644 index 00000000..7251cd31 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherGift.md @@ -0,0 +1,14 @@ +# RedemptionsGetResponseBodyVoucherGift + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/RedemptionsGetResponseBodyVoucherLoyaltyCard.md b/docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md new file mode 100644 index 00000000..f1306ffc --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md @@ -0,0 +1,15 @@ +# RedemptionsGetResponseBodyVoucherLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/RedemptionsGetResponseBodyVoucherPublish.md b/docs/RedemptionsGetResponseBodyVoucherPublish.md new file mode 100644 index 00000000..eeebf0de --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherPublish.md @@ -0,0 +1,14 @@ +# RedemptionsGetResponseBodyVoucherPublish + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/RedemptionsGetResponseBodyVoucherRedemption.md b/docs/RedemptionsGetResponseBodyVoucherRedemption.md new file mode 100644 index 00000000..d0b3ea88 --- /dev/null +++ b/docs/RedemptionsGetResponseBodyVoucherRedemption.md @@ -0,0 +1,16 @@ +# RedemptionsGetResponseBodyVoucherRedemption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/RedemptionsListResponseBody.md b/docs/RedemptionsListResponseBody.md new file mode 100644 index 00000000..2e033cc5 --- /dev/null +++ b/docs/RedemptionsListResponseBody.md @@ -0,0 +1,16 @@ +# RedemptionsListResponseBody + +Response body schema for **GET** `v1/redemptions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about redemptions in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of redemption objects. | [optional] [default to 'redemptions'] +**redemptions** | [**List[RedemptionsListResponseBodyRedemptionsItem]**](RedemptionsListResponseBodyRedemptionsItem.md) | | [optional] +**total** | **int** | Total number of redemptions. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItem.md b/docs/RedemptionsListResponseBodyRedemptionsItem.md new file mode 100644 index 00000000..fb398e66 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItem.md @@ -0,0 +1,35 @@ +# RedemptionsListResponseBodyRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**object** | **str** | | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the redeeming customer. | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**metadata** | **object** | | [optional] +**amount** | **int** | For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **str** | Unique redemption ID of the parent redemption. | [optional] +**result** | **str** | Redemption result. | [optional] +**status** | **str** | | [optional] +**related_redemptions** | [**RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md) | | [optional] +**failure_code** | **str** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failure_message** | **str** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**RedemptionsListResponseBodyRedemptionsItemOrder**](RedemptionsListResponseBodyRedemptionsItemOrder.md) | | [optional] +**channel** | [**RedemptionsListResponseBodyRedemptionsItemChannel**](RedemptionsListResponseBodyRedemptionsItemChannel.md) | | [optional] +**customer** | [**RedemptionsListResponseBodyRedemptionsItemCustomer**](RedemptionsListResponseBodyRedemptionsItemCustomer.md) | | [optional] +**related_object_type** | **str** | Defines the related object. | [optional] +**related_object_id** | **str** | | [optional] +**voucher** | [**RedemptionsListResponseBodyRedemptionsItemVoucher**](RedemptionsListResponseBodyRedemptionsItemVoucher.md) | | [optional] +**promotion_tier** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTier**](RedemptionsListResponseBodyRedemptionsItemPromotionTier.md) | | [optional] +**reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**RedemptionsListResponseBodyRedemptionsItemGift**](RedemptionsListResponseBodyRedemptionsItemGift.md) | | [optional] +**loyalty_card** | [**RedemptionsListResponseBodyRedemptionsItemLoyaltyCard**](RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md) | | [optional] +**reason** | **str** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemChannel.md b/docs/RedemptionsListResponseBodyRedemptionsItemChannel.md new file mode 100644 index 00000000..c97cb1dc --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemChannel.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemChannel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel_id** | **str** | | [optional] +**channel_type** | **str** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemCustomer.md b/docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md new file mode 100644 index 00000000..389583bc --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemCustomer.md @@ -0,0 +1,17 @@ +# RedemptionsListResponseBodyRedemptionsItemCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**email** | **str** | Customer's email address. | [optional] +**source_id** | **str** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionsListResponseBodyRedemptionsItemGift.md b/docs/RedemptionsListResponseBodyRedemptionsItemGift.md new file mode 100644 index 00000000..a5dbb08d --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemGift.md @@ -0,0 +1,12 @@ +# RedemptionsListResponseBodyRedemptionsItemGift + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md b/docs/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md new file mode 100644 index 00000000..61c960af --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.md @@ -0,0 +1,12 @@ +# RedemptionsListResponseBodyRedemptionsItemLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemOrder.md b/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md new file mode 100644 index 00000000..6cdd566c --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md @@ -0,0 +1,33 @@ +# RedemptionsListResponseBodyRedemptionsItemOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request. | [optional] +**source_id** | **str** | Unique source ID of an existing order that will be linked to the redemption of this request. | [optional] +**status** | **str** | The order status. | [optional] +**amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**initial_amount** | **int** | A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts. | [optional] +**discount_amount** | **int** | Sum of all order-level discounts applied to the order. | [optional] +**items_discount_amount** | **int** | Sum of all product-specific discounts applied to the order. | [optional] +**total_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied to the order. | [optional] +**total_amount** | **int** | Order amount after undoing all the discounts through the rollback redemption. | [optional] +**applied_discount_amount** | **int** | This field shows the order-level discount applied. | [optional] +**items_applied_discount_amount** | **int** | Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)` | [optional] +**total_applied_discount_amount** | **int** | Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | [optional] +**items** | [**List[OrderCalculatedItem]**](OrderCalculatedItem.md) | Array of items applied to the order. | [optional] +**metadata** | **object** | | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'order'] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was last updated in ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the customer making the purchase. | [optional] +**referrer_id** | **str** | Unique referrer ID. | [optional] +**customer** | [**RedemptionsListResponseBodyRedemptionsItemOrderCustomer**](RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md) | | [optional] +**referrer** | [**RedemptionsListResponseBodyRedemptionsItemOrderReferrer**](RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md) | | [optional] +**redemptions** | **object** | | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md b/docs/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md new file mode 100644 index 00000000..9b09f86e --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemOrderCustomer.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemOrderCustomer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md b/docs/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md new file mode 100644 index 00000000..4b6bce0c --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemOrderReferrer.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemOrderReferrer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md new file mode 100644 index 00000000..2ca49f83 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTier.md @@ -0,0 +1,33 @@ +# RedemptionsListResponseBodyRedemptionsItemPromotionTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique promotion tier ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format. | [optional] +**name** | **str** | Name of the promotion tier. | [optional] +**banner** | **str** | Text to be displayed to your customers on your website. | [optional] +**action** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierAction**](RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md) | | [optional] +**metadata** | **object** | | [optional] +**hierarchy** | **int** | The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. | [optional] +**promotion_id** | **str** | Promotion unique ID. | [optional] +**campaign** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign**](RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md) | | [optional] +**campaign_id** | **str** | Promotion tier's parent campaign's unique ID. | [optional] +**active** | **bool** | A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier | [optional] +**start_date** | **datetime** | Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**summary** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md) | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the promotion tier. | [optional] [default to 'promotion_tier'] +**validation_rule_assignments** | [**ValidationRuleAssignmentsList**](ValidationRuleAssignmentsList.md) | | [optional] +**category_id** | **str** | Promotion tier category ID. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md new file mode 100644 index 00000000..cb8d2de5 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.md @@ -0,0 +1,12 @@ +# RedemptionsListResponseBodyRedemptionsItemPromotionTierAction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md new file mode 100644 index 00000000..77820138 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.md @@ -0,0 +1,20 @@ +# RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID. | [optional] +**start_date** | **datetime** | Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the <!-- [Disable Campaign](OpenAPI.json/paths/~1campaigns~1{campaignId}~1disable) -->[Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign | [optional] +**category_id** | **str** | Unique category ID that this campaign belongs to. | [optional] +**object** | **str** | The type of the object represented by the campaign object. This object stores information about the campaign. | [optional] [default to 'campaign'] + +[[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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md new file mode 100644 index 00000000..13965733 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md) | | [optional] +**orders** | [**RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders**](RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md) | | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md new file mode 100644 index 00000000..d1d81881 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_amount** | **int** | Sum of order totals. | [optional] +**total_discount_amount** | **int** | Sum of total discount applied using the promotion tier. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md new file mode 100644 index 00000000..52795d8a --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.md @@ -0,0 +1,12 @@ +# RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_redeemed** | **int** | Number of times the promotion tier was redeemed. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md new file mode 100644 index 00000000..2924dc3a --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem]**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**List[RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem]**](RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md) | | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..44a26168 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..7543d3eb --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,13 @@ +# RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemVoucher.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md new file mode 100644 index 00000000..ae1d640c --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucher.md @@ -0,0 +1,41 @@ +# RedemptionsListResponseBodyRedemptionsItemVoucher + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**RedemptionsListResponseBodyRedemptionsItemVoucherGift**](RedemptionsListResponseBodyRedemptionsItemVoucherGift.md) | | [optional] +**loyalty_card** | [**RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard**](RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**RedemptionsListResponseBodyRedemptionsItemVoucherPublish**](RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md) | | [optional] +**redemption** | [**RedemptionsListResponseBodyRedemptionsItemVoucherRedemption**](RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] +**holder** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md new file mode 100644 index 00000000..939e51ba --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherGift.md @@ -0,0 +1,14 @@ +# RedemptionsListResponseBodyRedemptionsItemVoucherGift + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md new file mode 100644 index 00000000..d4386565 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md @@ -0,0 +1,15 @@ +# RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md new file mode 100644 index 00000000..5269982c --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherPublish.md @@ -0,0 +1,14 @@ +# RedemptionsListResponseBodyRedemptionsItemVoucherPublish + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md new file mode 100644 index 00000000..269fc956 --- /dev/null +++ b/docs/RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.md @@ -0,0 +1,16 @@ +# RedemptionsListResponseBodyRedemptionsItemVoucherRedemption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/RedemptionsRedeemRequestBody.md b/docs/RedemptionsRedeemRequestBody.md new file mode 100644 index 00000000..bd3d0431 --- /dev/null +++ b/docs/RedemptionsRedeemRequestBody.md @@ -0,0 +1,19 @@ +# RedemptionsRedeemRequestBody + +Response body schema for **POST** `v1/redemptions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**RedemptionsRedeemRequestBodyOptions**](RedemptionsRedeemRequestBodyOptions.md) | | [optional] +**redeemables** | [**List[RedemptionsRedeemRequestBodyRedeemablesItem]**](RedemptionsRedeemRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**session** | [**Session**](Session.md) | | [optional] +**tracking_id** | **str** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[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/RedemptionsRedeemRequestBodyOptions.md b/docs/RedemptionsRedeemRequestBodyOptions.md new file mode 100644 index 00000000..60ae8a2f --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyOptions.md @@ -0,0 +1,13 @@ +# RedemptionsRedeemRequestBodyOptions + +Configure parameters returned in the response. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **List[str]** | Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.<br>- Returns redemption object `metadata`.<br>- Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[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/RedemptionsRedeemRequestBodyRedeemablesItem.md b/docs/RedemptionsRedeemRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..962c2747 --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyRedeemablesItem.md @@ -0,0 +1,15 @@ +# RedemptionsRedeemRequestBodyRedeemablesItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | | [optional] +**id** | **str** | | [optional] +**gift** | [**RedemptionsRedeemRequestBodyRedeemablesItemGift**](RedemptionsRedeemRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**RedemptionsRedeemRequestBodyRedeemablesItemReward**](RedemptionsRedeemRequestBodyRedeemablesItemReward.md) | | [optional] + +[[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/RedemptionsRedeemRequestBodyRedeemablesItemGift.md b/docs/RedemptionsRedeemRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..80a1359a --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyRedeemablesItemGift.md @@ -0,0 +1,13 @@ +# RedemptionsRedeemRequestBodyRedeemablesItemGift + +Contains information on the number of gift card credits that the customer wants to apply to the order. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[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/RedemptionsRedeemRequestBodyRedeemablesItemReward.md b/docs/RedemptionsRedeemRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..5848beed --- /dev/null +++ b/docs/RedemptionsRedeemRequestBodyRedeemablesItemReward.md @@ -0,0 +1,14 @@ +# RedemptionsRedeemRequestBodyRedeemablesItemReward + +Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[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/RedemptionsRedeemResponseBody.md b/docs/RedemptionsRedeemResponseBody.md new file mode 100644 index 00000000..575327f1 --- /dev/null +++ b/docs/RedemptionsRedeemResponseBody.md @@ -0,0 +1,17 @@ +# RedemptionsRedeemResponseBody + +Response body schema for **POST** `v1/redemptions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redemptions** | [**List[Redemption]**](Redemption.md) | | [optional] +**parent_redemption** | [**Redemption**](Redemption.md) | | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**inapplicable_redeemables** | [**List[ValidationsRedeemableInapplicable]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**skipped_redeemables** | [**List[ValidationsRedeemableSkipped]**](ValidationsRedeemableSkipped.md) | Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`. | [optional] + +[[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/RedemptionsRollbackCreateRequestBody.md b/docs/RedemptionsRollbackCreateRequestBody.md new file mode 100644 index 00000000..7ce2df15 --- /dev/null +++ b/docs/RedemptionsRollbackCreateRequestBody.md @@ -0,0 +1,17 @@ +# RedemptionsRollbackCreateRequestBody + +Request body schema for **POST** `v1/redemptions/{redemptionId}/rollback`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reason** | **str** | Reason for the rollback. | [optional] +**tracking_id** | **str** | Customer's `source_id`. | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to update **redemption** metadata. | [optional] + +[[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/RedemptionsRollbackCreateResponseBody.md b/docs/RedemptionsRollbackCreateResponseBody.md new file mode 100644 index 00000000..64fb7ecf --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBody.md @@ -0,0 +1,36 @@ +# RedemptionsRollbackCreateResponseBody + +Response body schema for **POST** `v1/redemptions/{redemptionId}/rollback`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the redemption rollback. | [optional] +**object** | **str** | The type of the object represented by the JSON | [optional] [default to 'redemption_rollback'] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] +**customer_id** | **str** | Unique customer ID of the redeeming customer. | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the redemption. | [optional] +**amount** | **int** | For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer. | [optional] +**redemption** | **str** | Unique redemption ID of the parent redemption. | [optional] +**reason** | **str** | System generated cause for the redemption being invalid in the context of the provided parameters. | [optional] +**result** | **str** | Redemption result. | [optional] +**status** | **str** | Redemption status. | [optional] +**related_redemptions** | [**RedemptionsRollbackCreateResponseBodyRelatedRedemptions**](RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md) | | [optional] +**failure_code** | **str** | If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed. | [optional] +**failure_message** | **str** | If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**channel** | [**RedemptionsRollbackCreateResponseBodyChannel**](RedemptionsRollbackCreateResponseBodyChannel.md) | | [optional] +**customer** | [**SimpleCustomer**](SimpleCustomer.md) | | [optional] +**related_object_type** | **str** | Defines the related object. | [optional] +**related_object_id** | **str** | Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] +**voucher** | [**Voucher**](Voucher.md) | | [optional] +**promotion_tier** | [**PromotionTier**](PromotionTier.md) | | [optional] +**reward** | [**RedemptionRewardResult**](RedemptionRewardResult.md) | | [optional] +**gift** | [**RedemptionsRollbackCreateResponseBodyGift**](RedemptionsRollbackCreateResponseBodyGift.md) | | [optional] +**loyalty_card** | [**RedemptionsRollbackCreateResponseBodyLoyaltyCard**](RedemptionsRollbackCreateResponseBodyLoyaltyCard.md) | | [optional] + +[[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/RedemptionsRollbackCreateResponseBodyChannel.md b/docs/RedemptionsRollbackCreateResponseBodyChannel.md new file mode 100644 index 00000000..073dc1aa --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyChannel.md @@ -0,0 +1,14 @@ +# RedemptionsRollbackCreateResponseBodyChannel + +Defines the details of the channel through which the redemption was issued. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel_id** | **str** | Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API. | [optional] +**channel_type** | **str** | The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API. | [optional] + +[[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/RedemptionsRollbackCreateResponseBodyGift.md b/docs/RedemptionsRollbackCreateResponseBodyGift.md new file mode 100644 index 00000000..de51ed6c --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyGift.md @@ -0,0 +1,13 @@ +# RedemptionsRollbackCreateResponseBodyGift + +Contains the amount returned to the gift card in the redemption rollback. It is expressed as a negative integer. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned). | [optional] + +[[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/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md b/docs/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..b227dfec --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,13 @@ +# RedemptionsRollbackCreateResponseBodyLoyaltyCard + +Contains the number of points returned to the loyalty card in the reward redemption rollback. It is expressed as a negative integer. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer. | [optional] + +[[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/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md new file mode 100644 index 00000000..372de47f --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptions.md @@ -0,0 +1,13 @@ +# RedemptionsRollbackCreateResponseBodyRelatedRedemptions + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem]**](RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md) | | [optional] +**redemptions** | [**List[RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem]**](RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md) | | [optional] + +[[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/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md new file mode 100644 index 00000000..1dcd6587 --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.md @@ -0,0 +1,13 @@ +# RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md new file mode 100644 index 00000000..a8a5733a --- /dev/null +++ b/docs/RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.md @@ -0,0 +1,13 @@ +# RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of the redemption rollback. | [optional] +**var_date** | **datetime** | Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/RedemptionsRollbacksCreateRequestBody.md b/docs/RedemptionsRollbacksCreateRequestBody.md new file mode 100644 index 00000000..ac258dfc --- /dev/null +++ b/docs/RedemptionsRollbacksCreateRequestBody.md @@ -0,0 +1,17 @@ +# RedemptionsRollbacksCreateRequestBody + +Request body schema for **POST** `v1/redemptions/{parentRedemptionId}/rollbacks`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reason** | **str** | Reason for the rollback. | [optional] +**tracking_id** | **str** | Customer's `source_id`. | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**metadata** | **object** | A set of key/value pairs that you can send in the request body to update **redemption** metadata. | [optional] + +[[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/RedemptionsRollbacksCreateResponseBody.md b/docs/RedemptionsRollbacksCreateResponseBody.md new file mode 100644 index 00000000..bfd772d3 --- /dev/null +++ b/docs/RedemptionsRollbacksCreateResponseBody.md @@ -0,0 +1,15 @@ +# RedemptionsRollbacksCreateResponseBody + +Response body schema for POST `/redemptions/{parentRedemptionID}/rollbacks`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rollbacks** | [**List[RedemptionRollback]**](RedemptionRollback.md) | Contains the rollback redemption objects of the particular incentives. | [optional] +**parent_rollback** | [**RedemptionRollback**](RedemptionRollback.md) | | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] + +[[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/ReferralProgram.md b/docs/ReferralProgram.md new file mode 100644 index 00000000..85b2fe73 --- /dev/null +++ b/docs/ReferralProgram.md @@ -0,0 +1,15 @@ +# ReferralProgram + +Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversion_event_type** | **str** | Define how a referral is triggered. | [optional] +**custom_event** | [**ReferralProgramCustomEvent**](ReferralProgramCustomEvent.md) | | [optional] +**referee_reward** | [**ReferralProgramRefereeReward**](ReferralProgramRefereeReward.md) | | [optional] + +[[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/ReferralProgramCustomEvent.md b/docs/ReferralProgramCustomEvent.md new file mode 100644 index 00000000..6c84e4e4 --- /dev/null +++ b/docs/ReferralProgramCustomEvent.md @@ -0,0 +1,14 @@ +# ReferralProgramCustomEvent + +Contains details about the custom event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique custom event ID. | [optional] +**name** | **str** | Custom event name. | [optional] + +[[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/ReferralProgramRefereeReward.md b/docs/ReferralProgramRefereeReward.md new file mode 100644 index 00000000..548dbbde --- /dev/null +++ b/docs/ReferralProgramRefereeReward.md @@ -0,0 +1,15 @@ +# ReferralProgramRefereeReward + +Defines the referee reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**related_object_parent** | [**ReferralProgramRefereeRewardRelatedObjectParent**](ReferralProgramRefereeRewardRelatedObjectParent.md) | | [optional] +**type** | **str** | Type of reward. | [optional] +**amount** | **str** | Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] + +[[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/ReferralProgramRefereeRewardRelatedObjectParent.md b/docs/ReferralProgramRefereeRewardRelatedObjectParent.md new file mode 100644 index 00000000..e5b8b5c6 --- /dev/null +++ b/docs/ReferralProgramRefereeRewardRelatedObjectParent.md @@ -0,0 +1,15 @@ +# ReferralProgramRefereeRewardRelatedObjectParent + +Details of the resource from which the reward originates. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID of the reward source. | [optional] +**name** | **str** | Name of the reward source. | [optional] +**object** | **str** | Type of resource represented by the source of the reward. | [optional] [default to 'CAMPAIGN'] + +[[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/Referrer.md b/docs/Referrer.md new file mode 100644 index 00000000..3428502b --- /dev/null +++ b/docs/Referrer.md @@ -0,0 +1,21 @@ +# Referrer + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The ID of an existing customer. | [optional] +**source_id** | **str** | A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**description** | **str** | An arbitrary string that you can attach to a customer object. | [optional] +**email** | **str** | Customer's email address. | [optional] +**phone** | **str** | Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel. | [optional] +**birthday** | **date** | `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~. | [optional] +**birthdate** | **date** | Customer's birthdate; format YYYY-MM-DD. | [optional] +**address** | [**ReferrerAddress**](ReferrerAddress.md) | | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] + +[[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/ReferrerAddress.md b/docs/ReferrerAddress.md new file mode 100644 index 00000000..64632a7a --- /dev/null +++ b/docs/ReferrerAddress.md @@ -0,0 +1,18 @@ +# ReferrerAddress + +Customer's address. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **str** | City | [optional] +**state** | **str** | State | [optional] +**line_1** | **str** | First line of address. | [optional] +**line_2** | **str** | Second line of address. | [optional] +**country** | **str** | Country. | [optional] +**postal_code** | **str** | Postal code. | [optional] + +[[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/ReferrerId.md b/docs/ReferrerId.md new file mode 100644 index 00000000..73810e5d --- /dev/null +++ b/docs/ReferrerId.md @@ -0,0 +1,13 @@ +# ReferrerId + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier of an existing customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/ResourceTypes.md b/docs/ResourceTypes.md new file mode 100644 index 00000000..11c53ead --- /dev/null +++ b/docs/ResourceTypes.md @@ -0,0 +1,15 @@ +# ResourceTypes + +Types of usable resources. + +## Enum + +* `CAMPAIGN` (value: `'campaign'`) + +* `VOUCHER` (value: `'voucher'`) + +* `PROMOTION_TIER` (value: `'promotion_tier'`) + +[[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/Reward.md b/docs/Reward.md new file mode 100644 index 00000000..d3a2b7a2 --- /dev/null +++ b/docs/Reward.md @@ -0,0 +1,22 @@ +# Reward + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **str** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**RewardAttributes**](RewardAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **str** | Reward type. | [optional] +**parameters** | [**RewardType**](RewardType.md) | | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[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/RewardAssignment.md b/docs/RewardAssignment.md new file mode 100644 index 00000000..ab83e370 --- /dev/null +++ b/docs/RewardAssignment.md @@ -0,0 +1,19 @@ +# RewardAssignment + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**RewardAssignmentParameters**](RewardAssignmentParameters.md) | | [optional] + +[[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/RewardAssignmentParameters.md b/docs/RewardAssignmentParameters.md new file mode 100644 index 00000000..8c809461 --- /dev/null +++ b/docs/RewardAssignmentParameters.md @@ -0,0 +1,13 @@ +# RewardAssignmentParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**RewardAssignmentParametersLoyalty**](RewardAssignmentParametersLoyalty.md) | | [optional] + +[[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/RewardAssignmentParametersLoyalty.md b/docs/RewardAssignmentParametersLoyalty.md new file mode 100644 index 00000000..96848df1 --- /dev/null +++ b/docs/RewardAssignmentParametersLoyalty.md @@ -0,0 +1,13 @@ +# RewardAssignmentParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/RewardAttributes.md b/docs/RewardAttributes.md new file mode 100644 index 00000000..8b0d8806 --- /dev/null +++ b/docs/RewardAttributes.md @@ -0,0 +1,14 @@ +# RewardAttributes + +These properties are configurable for **material rewards**. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **str** | An arbitrary string that you can attach to a material reward. | [optional] + +[[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/RewardType.md b/docs/RewardType.md new file mode 100644 index 00000000..7ca49ac8 --- /dev/null +++ b/docs/RewardType.md @@ -0,0 +1,14 @@ +# RewardType + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**RewardTypeCampaign**](RewardTypeCampaign.md) | | [optional] +**coin** | [**RewardTypeCoin**](RewardTypeCoin.md) | | [optional] +**product** | [**RewardTypeProduct**](RewardTypeProduct.md) | | [optional] + +[[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/RewardTypeCampaign.md b/docs/RewardTypeCampaign.md new file mode 100644 index 00000000..3ea6f46a --- /dev/null +++ b/docs/RewardTypeCampaign.md @@ -0,0 +1,15 @@ +# RewardTypeCampaign + +Objects stores information about the campaign related to the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique campaign ID, assigned by Voucherify. | [optional] +**balance** | **int** | The number of points to be added to a loyalty card or the amount to be added to the current balance on the gift card. For gift cards, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**type** | **str** | Campaign type. | [optional] + +[[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/RewardTypeCoin.md b/docs/RewardTypeCoin.md new file mode 100644 index 00000000..36b89f10 --- /dev/null +++ b/docs/RewardTypeCoin.md @@ -0,0 +1,14 @@ +# RewardTypeCoin + +Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchange_ratio** | **float** | The cash equivalent of the points defined in the points_ratio property. | [optional] +**points_ratio** | **int** | The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property. | [optional] + +[[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/RewardTypeProduct.md b/docs/RewardTypeProduct.md new file mode 100644 index 00000000..b16da7d2 --- /dev/null +++ b/docs/RewardTypeProduct.md @@ -0,0 +1,14 @@ +# RewardTypeProduct + +Contains information about the product given as a reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID, assigned by Voucherify. | [optional] +**sku_id** | **str** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [optional] + +[[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/RewardsApi.md b/docs/RewardsApi.md new file mode 100644 index 00000000..caaaa55a --- /dev/null +++ b/docs/RewardsApi.md @@ -0,0 +1,896 @@ +# voucherify.RewardsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_reward**](RewardsApi.md#create_reward) | **POST** /v1/rewards | Create Reward +[**create_reward_assignment**](RewardsApi.md#create_reward_assignment) | **POST** /v1/rewards/{rewardId}/assignments | Create Reward Assignment +[**delete_reward**](RewardsApi.md#delete_reward) | **DELETE** /v1/rewards/{rewardId} | Delete Reward +[**delete_reward_assignment**](RewardsApi.md#delete_reward_assignment) | **DELETE** /v1/rewards/{rewardId}/assignments/{assignmentId} | Delete Reward Assignment +[**get_reward**](RewardsApi.md#get_reward) | **GET** /v1/rewards/{rewardId} | Get Reward +[**get_reward_assignment**](RewardsApi.md#get_reward_assignment) | **GET** /v1/rewards/{rewardId}/assignments/{assignmentId} | Get Reward Assignment +[**list_reward_assignments**](RewardsApi.md#list_reward_assignments) | **GET** /v1/rewards/{rewardId}/assignments | List Reward Assignments +[**list_rewards**](RewardsApi.md#list_rewards) | **GET** /v1/rewards | List Rewards +[**update_reward**](RewardsApi.md#update_reward) | **PUT** /v1/rewards/{rewardId} | Update Reward +[**update_reward_assignment**](RewardsApi.md#update_reward_assignment) | **PUT** /v1/rewards/{rewardId}/assignments/{assignmentId} | Update Reward Assignment + + +# **create_reward** +> RewardsCreateResponseBody create_reward(rewards_create_request_body=rewards_create_request_body) + +Create Reward + +Create a new reward. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.rewards_create_request_body import RewardsCreateRequestBody +from voucherify.models.rewards_create_response_body import RewardsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + rewards_create_request_body = {"name":"Digital - Gift Card Reward","type":"CAMPAIGN","metadata":{"Type":"Gift"},"parameters":{"campaign":{"id":"camp_hC2GdqYtOmTT45zfhib62cK1","balance":3000}}} # RewardsCreateRequestBody | Define parameters of the new reward. (optional) + + try: + # Create Reward + api_response = api_instance.create_reward(rewards_create_request_body=rewards_create_request_body) + print("The response of RewardsApi->create_reward:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->create_reward: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **rewards_create_request_body** | [**RewardsCreateRequestBody**](RewardsCreateRequestBody.md)| Define parameters of the new reward. | [optional] + +### Return type + +[**RewardsCreateResponseBody**](RewardsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a reward object. | - | + +[[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) + +# **create_reward_assignment** +> RewardsAssignmentsCreateResponseBody create_reward_assignment(reward_id, rewards_assignments_create_request_body=rewards_assignments_create_request_body) + +Create Reward Assignment + +Assigns a reward to a specified loyalty campaign. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.rewards_assignments_create_request_body import RewardsAssignmentsCreateRequestBody +from voucherify.models.rewards_assignments_create_response_body import RewardsAssignmentsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + rewards_assignments_create_request_body = {"campaign":"camp_OTuGGP90PivbvROsRvfM65El","parameters":{"loyalty":{"points":39}}} # RewardsAssignmentsCreateRequestBody | Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. (optional) + + try: + # Create Reward Assignment + api_response = api_instance.create_reward_assignment(reward_id, rewards_assignments_create_request_body=rewards_assignments_create_request_body) + print("The response of RewardsApi->create_reward_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->create_reward_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + **rewards_assignments_create_request_body** | [**RewardsAssignmentsCreateRequestBody**](RewardsAssignmentsCreateRequestBody.md)| Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. | [optional] + +### Return type + +[**RewardsAssignmentsCreateResponseBody**](RewardsAssignmentsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a reward assignment object. | - | + +[[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) + +# **delete_reward** +> delete_reward(reward_id) + +Delete Reward + +Delete a reward. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + + try: + # Delete Reward + api_instance.delete_reward(reward_id) + except Exception as e: + print("Exception when calling RewardsApi->delete_reward: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **delete_reward_assignment** +> delete_reward_assignment(reward_id, assignment_id) + +Delete Reward Assignment + +This method deletes a reward assignment for a particular reward. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. + + try: + # Delete Reward Assignment + api_instance.delete_reward_assignment(reward_id, assignment_id) + except Exception as e: + print("Exception when calling RewardsApi->delete_reward_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + **assignment_id** | **str**| A unique reward assignment ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **get_reward** +> Reward get_reward(reward_id) + +Get Reward + +Retrieve a reward by the reward ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.reward import Reward +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + + try: + # Get Reward + api_response = api_instance.get_reward(reward_id) + print("The response of RewardsApi->get_reward:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->get_reward: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + +### Return type + +[**Reward**](Reward.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a reward object if a valid identifier was provided. | - | + +[[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) + +# **get_reward_assignment** +> RewardsAssignmentsGetResponseBody get_reward_assignment(reward_id, assignment_id) + +Get Reward Assignment + +Retrieve a reward assignment. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.rewards_assignments_get_response_body import RewardsAssignmentsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. + + try: + # Get Reward Assignment + api_response = api_instance.get_reward_assignment(reward_id, assignment_id) + print("The response of RewardsApi->get_reward_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->get_reward_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + **assignment_id** | **str**| A unique reward assignment ID. | + +### Return type + +[**RewardsAssignmentsGetResponseBody**](RewardsAssignmentsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a reward assignment object. | - | + +[[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) + +# **list_reward_assignments** +> RewardsAssignmentsListResponseBody list_reward_assignments(reward_id, limit=limit, page=page) + +List Reward Assignments + +Retrieve reward assignments by the reward ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.rewards_assignments_list_response_body import RewardsAssignmentsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + + try: + # List Reward Assignments + api_response = api_instance.list_reward_assignments(reward_id, limit=limit, page=page) + print("The response of RewardsApi->list_reward_assignments:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->list_reward_assignments: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + +### Return type + +[**RewardsAssignmentsListResponseBody**](RewardsAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of reward assignment objects. Each object contains information regarding the resource to which the reward was assigned and the cost in loyalty points for the reward. | - | + +[[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) + +# **list_rewards** +> RewardsListResponseBody list_rewards(limit=limit, page=page, assignment_id=assignment_id) + +List Rewards + +Retrieve rewards. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.rewards_list_response_body import RewardsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. (optional) + + try: + # List Rewards + api_response = api_instance.list_rewards(limit=limit, page=page, assignment_id=assignment_id) + print("The response of RewardsApi->list_rewards:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->list_rewards: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **assignment_id** | **str**| A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. | [optional] + +### Return type + +[**RewardsListResponseBody**](RewardsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of reward objects. | - | + +[[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) + +# **update_reward** +> RewardsUpdateResponseBody update_reward(reward_id, rewards_update_request_body=rewards_update_request_body) + +Update Reward + +Update the details of a reward. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.rewards_update_request_body import RewardsUpdateRequestBody +from voucherify.models.rewards_update_response_body import RewardsUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + rewards_update_request_body = {"name":"Digital - Gift Card Reward","metadata":{"Type":"Gift"},"parameters":{"campaign":{"id":"camp_hC2GdqYtOmTT45zfhib62cK1","balance":3000}}} # RewardsUpdateRequestBody | Define the parameters to be updated for the reward. (optional) + + try: + # Update Reward + api_response = api_instance.update_reward(reward_id, rewards_update_request_body=rewards_update_request_body) + print("The response of RewardsApi->update_reward:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->update_reward: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + **rewards_update_request_body** | [**RewardsUpdateRequestBody**](RewardsUpdateRequestBody.md)| Define the parameters to be updated for the reward. | [optional] + +### Return type + +[**RewardsUpdateResponseBody**](RewardsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an updated reward object. | - | + +[[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) + +# **update_reward_assignment** +> RewardsAssignmentsUpdateResponseBody update_reward_assignment(reward_id, assignment_id, rewards_assignments_update_request_body=rewards_assignments_update_request_body) + +Update Reward Assignment + +Update the number of points needed to successfully redeem the reward. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.rewards_assignments_update_request_body import RewardsAssignmentsUpdateRequestBody +from voucherify.models.rewards_assignments_update_response_body import RewardsAssignmentsUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.RewardsApi(api_client) + reward_id = 'reward_id_example' # str | A unique reward ID. + assignment_id = 'assignment_id_example' # str | A unique reward assignment ID. + rewards_assignments_update_request_body = {"parameters":{"loyalty":{"points":35}}} # RewardsAssignmentsUpdateRequestBody | Define the number of points required to exchange for the reward. (optional) + + try: + # Update Reward Assignment + api_response = api_instance.update_reward_assignment(reward_id, assignment_id, rewards_assignments_update_request_body=rewards_assignments_update_request_body) + print("The response of RewardsApi->update_reward_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RewardsApi->update_reward_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **reward_id** | **str**| A unique reward ID. | + **assignment_id** | **str**| A unique reward assignment ID. | + **rewards_assignments_update_request_body** | [**RewardsAssignmentsUpdateRequestBody**](RewardsAssignmentsUpdateRequestBody.md)| Define the number of points required to exchange for the reward. | [optional] + +### Return type + +[**RewardsAssignmentsUpdateResponseBody**](RewardsAssignmentsUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the updated reward assignment object. | - | + +[[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) + diff --git a/docs/RewardsAssignmentsCreateRequestBody.md b/docs/RewardsAssignmentsCreateRequestBody.md new file mode 100644 index 00000000..9b9facc1 --- /dev/null +++ b/docs/RewardsAssignmentsCreateRequestBody.md @@ -0,0 +1,14 @@ +# RewardsAssignmentsCreateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | **str** | The campaign ID of the campaign to which the reward is to be assigned. | [optional] +**parameters** | [**RewardsAssignmentsCreateRequestBodyParameters**](RewardsAssignmentsCreateRequestBodyParameters.md) | | [optional] +**validation_rules** | **List[str]** | | [optional] + +[[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/RewardsAssignmentsCreateRequestBodyParameters.md b/docs/RewardsAssignmentsCreateRequestBodyParameters.md new file mode 100644 index 00000000..82ae790a --- /dev/null +++ b/docs/RewardsAssignmentsCreateRequestBodyParameters.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsCreateRequestBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**RewardsAssignmentsCreateRequestBodyParametersLoyalty**](RewardsAssignmentsCreateRequestBodyParametersLoyalty.md) | | [optional] + +[[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/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md b/docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md new file mode 100644 index 00000000..bc302471 --- /dev/null +++ b/docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsCreateRequestBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer. | [optional] + +[[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/RewardsAssignmentsCreateResponseBody.md b/docs/RewardsAssignmentsCreateResponseBody.md new file mode 100644 index 00000000..3563fcfc --- /dev/null +++ b/docs/RewardsAssignmentsCreateResponseBody.md @@ -0,0 +1,20 @@ +# RewardsAssignmentsCreateResponseBody + +Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**RewardsAssignmentsCreateResponseBodyParameters**](RewardsAssignmentsCreateResponseBodyParameters.md) | | [optional] + +[[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/RewardsAssignmentsCreateResponseBodyParameters.md b/docs/RewardsAssignmentsCreateResponseBodyParameters.md new file mode 100644 index 00000000..bba958ed --- /dev/null +++ b/docs/RewardsAssignmentsCreateResponseBodyParameters.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsCreateResponseBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**RewardsAssignmentsCreateResponseBodyParametersLoyalty**](RewardsAssignmentsCreateResponseBodyParametersLoyalty.md) | | [optional] + +[[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/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md b/docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..9b356b72 --- /dev/null +++ b/docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsCreateResponseBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/RewardsAssignmentsGetResponseBody.md b/docs/RewardsAssignmentsGetResponseBody.md new file mode 100644 index 00000000..70bf0e8f --- /dev/null +++ b/docs/RewardsAssignmentsGetResponseBody.md @@ -0,0 +1,20 @@ +# RewardsAssignmentsGetResponseBody + +Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**RewardsAssignmentsGetResponseBodyParameters**](RewardsAssignmentsGetResponseBodyParameters.md) | | [optional] + +[[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/RewardsAssignmentsGetResponseBodyParameters.md b/docs/RewardsAssignmentsGetResponseBodyParameters.md new file mode 100644 index 00000000..4828cb2a --- /dev/null +++ b/docs/RewardsAssignmentsGetResponseBodyParameters.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsGetResponseBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**RewardsAssignmentsGetResponseBodyParametersLoyalty**](RewardsAssignmentsGetResponseBodyParametersLoyalty.md) | | [optional] + +[[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/RewardsAssignmentsGetResponseBodyParametersLoyalty.md b/docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..caee23a7 --- /dev/null +++ b/docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsGetResponseBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/RewardsAssignmentsListResponseBody.md b/docs/RewardsAssignmentsListResponseBody.md new file mode 100644 index 00000000..f66904fd --- /dev/null +++ b/docs/RewardsAssignmentsListResponseBody.md @@ -0,0 +1,16 @@ +# RewardsAssignmentsListResponseBody + +Response body schema for **GET** `v1/rewards/{rewardID}/assignments`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about reward assignments in a dictionary. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of reward assignments. | [optional] [default to 'data'] +**data** | [**List[RewardAssignment]**](RewardAssignment.md) | | [optional] +**total** | **int** | Total number of reward assignments. | [optional] + +[[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/RewardsAssignmentsUpdateRequestBody.md b/docs/RewardsAssignmentsUpdateRequestBody.md new file mode 100644 index 00000000..d90cfe74 --- /dev/null +++ b/docs/RewardsAssignmentsUpdateRequestBody.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsUpdateRequestBody + +Request body schema for **PUT** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**RewardsAssignmentsUpdateRequestBodyParameters**](RewardsAssignmentsUpdateRequestBodyParameters.md) | | [optional] + +[[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/RewardsAssignmentsUpdateRequestBodyParameters.md b/docs/RewardsAssignmentsUpdateRequestBodyParameters.md new file mode 100644 index 00000000..613b23b4 --- /dev/null +++ b/docs/RewardsAssignmentsUpdateRequestBodyParameters.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsUpdateRequestBodyParameters + +An object that defines the price of the reward in loyalty points. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**RewardsAssignmentsUpdateRequestBodyParametersLoyalty**](RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md) | | [optional] + +[[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/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md b/docs/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md new file mode 100644 index 00000000..46fcd256 --- /dev/null +++ b/docs/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsUpdateRequestBodyParametersLoyalty + +Stores the points parameter. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Defines how many points are required to obtain the reward. | [optional] + +[[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/RewardsAssignmentsUpdateResponseBody.md b/docs/RewardsAssignmentsUpdateResponseBody.md new file mode 100644 index 00000000..3b50ad2f --- /dev/null +++ b/docs/RewardsAssignmentsUpdateResponseBody.md @@ -0,0 +1,20 @@ +# RewardsAssignmentsUpdateResponseBody + +Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward assignment ID, assigned by Voucherify. | [optional] +**reward_id** | **str** | Associated reward ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward assignment. | [optional] [default to 'reward_assignment'] +**related_object_id** | **str** | Related object ID to which the reward was assigned. | [optional] +**related_object_type** | **str** | Related object type to which the reward was assigned. | [optional] [default to 'campaign'] +**parameters** | [**RewardsAssignmentsUpdateResponseBodyParameters**](RewardsAssignmentsUpdateResponseBodyParameters.md) | | [optional] + +[[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/RewardsAssignmentsUpdateResponseBodyParameters.md b/docs/RewardsAssignmentsUpdateResponseBodyParameters.md new file mode 100644 index 00000000..96afd9b2 --- /dev/null +++ b/docs/RewardsAssignmentsUpdateResponseBodyParameters.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsUpdateResponseBodyParameters + +Defines the cost of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loyalty** | [**RewardsAssignmentsUpdateResponseBodyParametersLoyalty**](RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md) | | [optional] + +[[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/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md b/docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md new file mode 100644 index 00000000..1400b528 --- /dev/null +++ b/docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md @@ -0,0 +1,13 @@ +# RewardsAssignmentsUpdateResponseBodyParametersLoyalty + +Defines the equivalent points value of the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | The number of points required to redeem the reward. | [optional] + +[[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/RewardsCreateRequestBody.md b/docs/RewardsCreateRequestBody.md new file mode 100644 index 00000000..ced7cb33 --- /dev/null +++ b/docs/RewardsCreateRequestBody.md @@ -0,0 +1,16 @@ +# RewardsCreateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Reward name. | [optional] +**parameters** | [**RewardsCreateRequestBodyParameters**](RewardsCreateRequestBodyParameters.md) | | [optional] +**metadata** | **object** | | [optional] +**stock** | **int** | The number of units of the product that you want to share as a reward. | [optional] +**attributes** | [**RewardsCreateRequestBodyAttributes**](RewardsCreateRequestBodyAttributes.md) | | [optional] + +[[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/RewardsCreateRequestBodyAttributes.md b/docs/RewardsCreateRequestBodyAttributes.md new file mode 100644 index 00000000..434f7c2a --- /dev/null +++ b/docs/RewardsCreateRequestBodyAttributes.md @@ -0,0 +1,14 @@ +# RewardsCreateRequestBodyAttributes + +Attributes of a material reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**image_url** | **str** | HTTPS URL pointing to a .png or .jpg file. | [optional] +**description** | **str** | Description of a material reward. | [optional] + +[[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/RewardsCreateRequestBodyParameters.md b/docs/RewardsCreateRequestBodyParameters.md new file mode 100644 index 00000000..924b510d --- /dev/null +++ b/docs/RewardsCreateRequestBodyParameters.md @@ -0,0 +1,14 @@ +# RewardsCreateRequestBodyParameters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**RewardsCreateRequestBodyParametersCampaign**](RewardsCreateRequestBodyParametersCampaign.md) | | [optional] +**product** | [**RewardsCreateRequestBodyParametersProduct**](RewardsCreateRequestBodyParametersProduct.md) | | [optional] +**coin** | [**RewardsCreateRequestBodyParametersCoin**](RewardsCreateRequestBodyParametersCoin.md) | | [optional] + +[[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/RewardsCreateRequestBodyParametersCampaign.md b/docs/RewardsCreateRequestBodyParametersCampaign.md new file mode 100644 index 00000000..7f6ff267 --- /dev/null +++ b/docs/RewardsCreateRequestBodyParametersCampaign.md @@ -0,0 +1,13 @@ +# RewardsCreateRequestBodyParametersCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**balance** | **int** | The incremental points to be added to the current balance on the loyalty card. and The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] + +[[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/RewardsCreateRequestBodyParametersCoin.md b/docs/RewardsCreateRequestBodyParametersCoin.md new file mode 100644 index 00000000..18e5a036 --- /dev/null +++ b/docs/RewardsCreateRequestBodyParametersCoin.md @@ -0,0 +1,14 @@ +# RewardsCreateRequestBodyParametersCoin + +Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchange_ratio** | **str** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] +**points_ratio** | **str** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] + +[[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/RewardsCreateRequestBodyParametersProduct.md b/docs/RewardsCreateRequestBodyParametersProduct.md new file mode 100644 index 00000000..b4e310ee --- /dev/null +++ b/docs/RewardsCreateRequestBodyParametersProduct.md @@ -0,0 +1,14 @@ +# RewardsCreateRequestBodyParametersProduct + +Define the product given as a reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID, assigned by Voucherify, given as a reward. | [optional] +**sku_id** | **str** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [optional] + +[[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/RewardsCreateResponseBody.md b/docs/RewardsCreateResponseBody.md new file mode 100644 index 00000000..63904869 --- /dev/null +++ b/docs/RewardsCreateResponseBody.md @@ -0,0 +1,23 @@ +# RewardsCreateResponseBody + +Response body schema for **POST** `v1/rewards`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **str** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**RewardsCreateResponseBodyAttributes**](RewardsCreateResponseBodyAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **str** | Reward type. | [optional] +**parameters** | [**RewardType**](RewardType.md) | | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[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/RewardsCreateResponseBodyAttributes.md b/docs/RewardsCreateResponseBodyAttributes.md new file mode 100644 index 00000000..acf1e8b1 --- /dev/null +++ b/docs/RewardsCreateResponseBodyAttributes.md @@ -0,0 +1,14 @@ +# RewardsCreateResponseBodyAttributes + +These properties are configurable for **material rewards**. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **str** | An arbitrary string that you can attach to a material reward. | [optional] + +[[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/RewardsListResponseBody.md b/docs/RewardsListResponseBody.md new file mode 100644 index 00000000..66cd8a8a --- /dev/null +++ b/docs/RewardsListResponseBody.md @@ -0,0 +1,16 @@ +# RewardsListResponseBody + +Response body schema for **GET** `v1/rewards`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of transaction objects. | [optional] [default to 'data'] +**data** | [**List[Reward]**](Reward.md) | A dictionary that contains an array of rewards. Each entry in the array is a separate transaction object. | [optional] +**total** | **int** | Returns how many rewards in the project meet the limits defined by the query parameter definitions. | [optional] + +[[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/RewardsUpdateRequestBody.md b/docs/RewardsUpdateRequestBody.md new file mode 100644 index 00000000..20587c2d --- /dev/null +++ b/docs/RewardsUpdateRequestBody.md @@ -0,0 +1,16 @@ +# RewardsUpdateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Reward name. | [optional] +**parameters** | [**RewardsUpdateRequestBodyParameters**](RewardsUpdateRequestBodyParameters.md) | | [optional] +**metadata** | **object** | | [optional] +**stock** | **int** | The number of units of the product that you want to share as a reward. | [optional] +**attributes** | [**RewardsUpdateRequestBodyAttributes**](RewardsUpdateRequestBodyAttributes.md) | | [optional] + +[[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/RewardsUpdateRequestBodyAttributes.md b/docs/RewardsUpdateRequestBodyAttributes.md new file mode 100644 index 00000000..8cfa79df --- /dev/null +++ b/docs/RewardsUpdateRequestBodyAttributes.md @@ -0,0 +1,14 @@ +# RewardsUpdateRequestBodyAttributes + +Attributes of a material reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**image_url** | **str** | HTTPS URL pointing to a .png or .jpg file. | [optional] +**description** | **str** | Description of a material reward. | [optional] + +[[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/RewardsUpdateRequestBodyParameters.md b/docs/RewardsUpdateRequestBodyParameters.md new file mode 100644 index 00000000..664eac7b --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParameters.md @@ -0,0 +1,14 @@ +# RewardsUpdateRequestBodyParameters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | [**RewardsUpdateRequestBodyParametersCampaign**](RewardsUpdateRequestBodyParametersCampaign.md) | | [optional] +**product** | [**RewardsUpdateRequestBodyParametersProduct**](RewardsUpdateRequestBodyParametersProduct.md) | | [optional] +**coin** | [**RewardsUpdateRequestBodyParametersCoin**](RewardsUpdateRequestBodyParametersCoin.md) | | [optional] + +[[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/RewardsUpdateRequestBodyParametersCampaign.md b/docs/RewardsUpdateRequestBodyParametersCampaign.md new file mode 100644 index 00000000..f8c8470c --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParametersCampaign.md @@ -0,0 +1,13 @@ +# RewardsUpdateRequestBodyParametersCampaign + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**balance** | **int** | The incremental points to be added to the current balance on the loyalty card. and The incremental amount to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] + +[[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/RewardsUpdateRequestBodyParametersCoin.md b/docs/RewardsUpdateRequestBodyParametersCoin.md new file mode 100644 index 00000000..fda46e34 --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParametersCoin.md @@ -0,0 +1,14 @@ +# RewardsUpdateRequestBodyParametersCoin + +Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**exchange_ratio** | **str** | The cash equivalent of the points defined in the `points_ratio` property. | [optional] +**points_ratio** | **str** | The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property. | [optional] + +[[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/RewardsUpdateRequestBodyParametersProduct.md b/docs/RewardsUpdateRequestBodyParametersProduct.md new file mode 100644 index 00000000..42f4fa6d --- /dev/null +++ b/docs/RewardsUpdateRequestBodyParametersProduct.md @@ -0,0 +1,14 @@ +# RewardsUpdateRequestBodyParametersProduct + +Define the product given as a reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID, assigned by Voucherify, given as a reward. | [optional] +**sku_id** | **str** | Unique SKU ID, assigned by Voucherify, of the SKU given as a reward. | [optional] + +[[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/RewardsUpdateResponseBody.md b/docs/RewardsUpdateResponseBody.md new file mode 100644 index 00000000..14b2a83c --- /dev/null +++ b/docs/RewardsUpdateResponseBody.md @@ -0,0 +1,23 @@ +# RewardsUpdateResponseBody + +Response body schema for **PUT** `v1/rewards/{rewardId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID, assigned by Voucherify. | [optional] +**name** | **str** | Reward name. | [optional] +**stock** | **int** | Configurable for **material rewards**. The number of units of the product that you want to share as reward. | [optional] +**redeemed** | **int** | Defines the number of already invoked (successful) reward redemptions. | [optional] +**attributes** | [**RewardsUpdateResponseBodyAttributes**](RewardsUpdateResponseBodyAttributes.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format. | [optional] +**type** | **str** | Reward type. | [optional] +**parameters** | [**RewardType**](RewardType.md) | | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the reward. | [default to 'reward'] + +[[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/RewardsUpdateResponseBodyAttributes.md b/docs/RewardsUpdateResponseBodyAttributes.md new file mode 100644 index 00000000..921cbbdf --- /dev/null +++ b/docs/RewardsUpdateResponseBodyAttributes.md @@ -0,0 +1,14 @@ +# RewardsUpdateResponseBodyAttributes + +These properties are configurable for **material rewards**. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file. | [optional] +**description** | **str** | An arbitrary string that you can attach to a material reward. | [optional] + +[[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/SegmentsApi.md b/docs/SegmentsApi.md new file mode 100644 index 00000000..7289180e --- /dev/null +++ b/docs/SegmentsApi.md @@ -0,0 +1,267 @@ +# voucherify.SegmentsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_segment**](SegmentsApi.md#create_segment) | **POST** /v1/segments | Create Segment +[**delete_segment**](SegmentsApi.md#delete_segment) | **DELETE** /v1/segments/{segmentId} | Delete Segment +[**get_segment**](SegmentsApi.md#get_segment) | **GET** /v1/segments/{segmentId} | Get Segment + + +# **create_segment** +> SegmentsCreateResponseBody create_segment(segments_create_request_body=segments_create_request_body) + +Create Segment + +Create a customer segment. ๐Ÿšง Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.segments_create_request_body import SegmentsCreateRequestBody +from voucherify.models.segments_create_response_body import SegmentsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.SegmentsApi(api_client) + segments_create_request_body = {"name":"Customers in a new Segment","type":"static","customers":["cust_iajsExT2QB4sGWzABY85WRqV","cust_sehkNIi8Uq2qQuRqSr7xn4Zi"]} # SegmentsCreateRequestBody | Specify the boundary conditions for the customer segment. (optional) + + try: + # Create Segment + api_response = api_instance.create_segment(segments_create_request_body=segments_create_request_body) + print("The response of SegmentsApi->create_segment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling SegmentsApi->create_segment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **segments_create_request_body** | [**SegmentsCreateRequestBody**](SegmentsCreateRequestBody.md)| Specify the boundary conditions for the customer segment. | [optional] + +### Return type + +[**SegmentsCreateResponseBody**](SegmentsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a customer segment object. | - | + +[[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) + +# **delete_segment** +> delete_segment(segment_id) + +Delete Segment + +This method deletes a customer segment. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.SegmentsApi(api_client) + segment_id = 'segment_id_example' # str | A unique customer segment ID. + + try: + # Delete Segment + api_instance.delete_segment(segment_id) + except Exception as e: + print("Exception when calling SegmentsApi->delete_segment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **segment_id** | **str**| A unique customer segment ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **get_segment** +> SegmentsGetResponseBody get_segment(segment_id) + +Get Segment + +Retrieves the segment with given segment ID. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.segments_get_response_body import SegmentsGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.SegmentsApi(api_client) + segment_id = 'segment_id_example' # str | A unique customer segment ID. + + try: + # Get Segment + api_response = api_instance.get_segment(segment_id) + print("The response of SegmentsApi->get_segment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling SegmentsApi->get_segment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **segment_id** | **str**| A unique customer segment ID. | + +### Return type + +[**SegmentsGetResponseBody**](SegmentsGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns segment object. | - | + +[[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) + diff --git a/docs/SegmentsCreateRequestBody.md b/docs/SegmentsCreateRequestBody.md new file mode 100644 index 00000000..49597e94 --- /dev/null +++ b/docs/SegmentsCreateRequestBody.md @@ -0,0 +1,15 @@ +# SegmentsCreateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Segment name. | [optional] +**type** | **str** | | [optional] +**customers** | **List[str]** | Array of customer IDs. | [optional] +**filter** | **object** | Defines a set of criteria for an `auto-update` segment type. | [optional] + +[[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/SegmentsCreateResponseBody.md b/docs/SegmentsCreateResponseBody.md new file mode 100644 index 00000000..de55565d --- /dev/null +++ b/docs/SegmentsCreateResponseBody.md @@ -0,0 +1,19 @@ +# SegmentsCreateResponseBody + +Response body schema for **POST** `v1/segments`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique segment ID. | [optional] +**name** | **str** | Segment name. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. | [optional] +**type** | **str** | Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). | [optional] +**filter** | **object** | Defines a set of criteria for an `auto-update` segment type. | [optional] +**initial_sync_status** | **str** | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the customer segment. | [optional] [default to 'segment'] + +[[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/SegmentsGetResponseBody.md b/docs/SegmentsGetResponseBody.md new file mode 100644 index 00000000..c9a7de4a --- /dev/null +++ b/docs/SegmentsGetResponseBody.md @@ -0,0 +1,19 @@ +# SegmentsGetResponseBody + +Response body schema for **GET** `v1/v1/segments/{segmentId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique segment ID. | [optional] +**name** | **str** | Segment name. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format. | [optional] +**type** | **str** | Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers). | [optional] +**filter** | **object** | Defines a set of criteria for an `auto-update` segment type. | [optional] +**initial_sync_status** | **str** | | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the customer segment. | [optional] [default to 'segment'] + +[[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/Session.md b/docs/Session.md new file mode 100644 index 00000000..6f01cb96 --- /dev/null +++ b/docs/Session.md @@ -0,0 +1,15 @@ +# Session + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **str** | The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated. | [optional] +**type** | **str** | This parameter is required to establish a new session. | [optional] [default to 'LOCK'] +**ttl** | **float** | Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter. | [optional] +**ttl_unit** | **str** | Defines the type of unit in which the session time is counted. | [optional] + +[[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/SimpleCustomer.md b/docs/SimpleCustomer.md new file mode 100644 index 00000000..b39459dc --- /dev/null +++ b/docs/SimpleCustomer.md @@ -0,0 +1,18 @@ +# SimpleCustomer + +Simplified customer data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique identifier of an existing customer. It is assigned by Voucherify. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**email** | **str** | Customer's email address. | [optional] +**source_id** | **str** | A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service. | [optional] +**metadata** | **object** | A set of custom key/value pairs that are attached to the customer. It stores all custom attributes assigned to the customer. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'customer'] + +[[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/SimpleCustomerRequiredObjectType.md b/docs/SimpleCustomerRequiredObjectType.md new file mode 100644 index 00000000..bd37d6b1 --- /dev/null +++ b/docs/SimpleCustomerRequiredObjectType.md @@ -0,0 +1,18 @@ +# SimpleCustomerRequiredObjectType + +This is an object representing a customer with limited properties used in Event Tracking endpoints. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | The unique ID of a customer that is assigned by Voucherify. | [optional] +**source_id** | **str** | The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. | [optional] +**name** | **str** | Customer's first and last name. | [optional] +**email** | **str** | Customer's email address. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. | [optional] +**object** | **str** | The type of the object represented by the JSON. This object stores information about the customer. | [optional] [default to 'customer'] + +[[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/SimpleLoyaltyCard.md b/docs/SimpleLoyaltyCard.md new file mode 100644 index 00000000..10c1d672 --- /dev/null +++ b/docs/SimpleLoyaltyCard.md @@ -0,0 +1,16 @@ +# SimpleLoyaltyCard + +Simplified loyalty card data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **str** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/SimpleProductDiscountUnit.md b/docs/SimpleProductDiscountUnit.md new file mode 100644 index 00000000..97c1b3bb --- /dev/null +++ b/docs/SimpleProductDiscountUnit.md @@ -0,0 +1,14 @@ +# SimpleProductDiscountUnit + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID, assigned by Voucherify. | [optional] +**source_id** | **str** | Product's source ID. | [optional] +**name** | **str** | Product name. | [optional] + +[[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/SimpleSegment.md b/docs/SimpleSegment.md new file mode 100644 index 00000000..c1be1366 --- /dev/null +++ b/docs/SimpleSegment.md @@ -0,0 +1,14 @@ +# SimpleSegment + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique segment ID. | [optional] +**name** | **str** | Segment name. | [optional] +**object** | **str** | The type of the object represented by the ID. | [optional] [default to 'segment'] + +[[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/SimpleSkuDiscountUnit.md b/docs/SimpleSkuDiscountUnit.md new file mode 100644 index 00000000..125f5323 --- /dev/null +++ b/docs/SimpleSkuDiscountUnit.md @@ -0,0 +1,14 @@ +# SimpleSkuDiscountUnit + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique SKU ID, assigned by Voucherify. | [optional] +**source_id** | **str** | Product variant's source ID. | [optional] +**name** | **str** | Sku name | [optional] + +[[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/SimpleVoucher.md b/docs/SimpleVoucher.md new file mode 100644 index 00000000..31efaf23 --- /dev/null +++ b/docs/SimpleVoucher.md @@ -0,0 +1,33 @@ +# SimpleVoucher + +Simplified voucher data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the voucher assigned by Voucherify. | [optional] +**code** | **str** | Voucher code. | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**type** | **str** | Type of the voucher. | [optional] +**campaign** | **str** | Campaign name. | [optional] +**campaign_id** | **str** | Campaign unique ID. | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referrer assigned by Voucherify. | [optional] +**category_id** | **str** | Unique identifier of the category that this voucher belongs to. | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**active** | **bool** | Shows whether the voucher is on or off. `true` indicates an *active* voucher and `false` indicates an *inactive* voucher. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the order was created in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format. | [optional] +**redemption** | [**SimpleVoucherRedemption**](SimpleVoucherRedemption.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**metadata** | **object** | A set of custom key/value pairs that you can attach to a voucher. The metadata object stores all custom attributes assigned to the voucher. | [optional] +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'voucher'] + +[[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/SimpleVoucherRedemption.md b/docs/SimpleVoucherRedemption.md new file mode 100644 index 00000000..491eff8f --- /dev/null +++ b/docs/SimpleVoucherRedemption.md @@ -0,0 +1,14 @@ +# SimpleVoucherRedemption + +Defines the redemption limits on vouchers. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] + +[[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/Sku.md b/docs/Sku.md new file mode 100644 index 00000000..86292aa0 --- /dev/null +++ b/docs/Sku.md @@ -0,0 +1,24 @@ +# Sku + +This is an object representing a product SKU. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**source_id** | **str** | A unique SKU identifier from your inventory system. | [optional] +**product_id** | **str** | The parent product's unique ID. | [optional] +**sku** | **str** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **str** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[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/SkusGetResponseBody.md b/docs/SkusGetResponseBody.md new file mode 100644 index 00000000..9b4973f0 --- /dev/null +++ b/docs/SkusGetResponseBody.md @@ -0,0 +1,24 @@ +# SkusGetResponseBody + +Response body schema for **GET** `v1/skus/{skuId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique identifier that represents the SKU and is assigned by Voucherify. | [optional] +**source_id** | **str** | A unique SKU identifier from your inventory system. | [optional] +**product_id** | **str** | The parent product's unique ID. | [optional] +**sku** | **str** | Unique user-defined SKU name. | [optional] +**price** | **int** | Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`. | [optional] +**currency** | **str** | SKU price currency. | [optional] +**attributes** | **object** | The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family. | [optional] +**image_url** | **str** | The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the `SKU`. | [optional] [default to 'sku'] + +[[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/SkusImportCsvCreateResponseBody.md b/docs/SkusImportCsvCreateResponseBody.md new file mode 100644 index 00000000..4acfabe2 --- /dev/null +++ b/docs/SkusImportCsvCreateResponseBody.md @@ -0,0 +1,13 @@ +# SkusImportCsvCreateResponseBody + +Response body schema for **POST** `v1/skus/importCSV`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/SkusListForProduct.md b/docs/SkusListForProduct.md new file mode 100644 index 00000000..23ef01ca --- /dev/null +++ b/docs/SkusListForProduct.md @@ -0,0 +1,16 @@ +# SkusListForProduct + +Contains information about child SKUs. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about SKUs. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of SKUs. | [optional] [default to 'data'] +**data** | [**List[Sku]**](Sku.md) | A dictionary that contains an array of SKUs. | [optional] +**total** | **int** | Total number of SKUs in the product. | [optional] + +[[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/StackingRules.md b/docs/StackingRules.md new file mode 100644 index 00000000..b5d24124 --- /dev/null +++ b/docs/StackingRules.md @@ -0,0 +1,23 @@ +# StackingRules + +Defines stacking rules for redeemables. Read more in the [Help Center](https://support.voucherify.io/article/604-stacking-rules) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**redeemables_limit** | **int** | Defines how many redeemables can be sent in one stacking request (note: more redeemables means more processing time!). | [optional] [default to 30] +**applicable_redeemables_limit** | **int** | Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED. | [optional] [default to 5] +**applicable_redeemables_per_category_limit** | **int** | Defines how many redeemables per category can be applied in one request. | [optional] [default to 1] +**applicable_exclusive_redeemables_limit** | **int** | Defines how many redeemables with an exclusive category can be applied in one request. | [optional] [default to 1] +**applicable_exclusive_redeemables_per_category_limit** | **int** | Defines how many redeemables with an exclusive category per category in stacking rules can be applied in one request. | [optional] [default to 1] +**exclusive_categories** | **List[str]** | Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint. | [optional] [default to []] +**joint_categories** | **List[str]** | Lists all joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns. | [optional] [default to []] +**redeemables_application_mode** | **str** | Defines redeemables application mode. | [optional] +**redeemables_sorting_rule** | **str** | Defines redeemables sorting rule. | [optional] [default to 'REQUESTED_ORDER'] +**redeemables_products_application_mode** | **str** | Defines redeemables products application mode. | [optional] +**redeemables_no_effect_rule** | **str** | Defines redeemables no effect rule. | [optional] + +[[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/ValidationRule.md b/docs/ValidationRule.md new file mode 100644 index 00000000..d2e9fac4 --- /dev/null +++ b/docs/ValidationRule.md @@ -0,0 +1,22 @@ +# ValidationRule + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**ValidationRuleError**](ValidationRuleError.md) | | [optional] +**applicable_to** | [**ValidationRuleApplicableTo**](ValidationRuleApplicableTo.md) | | [optional] +**type** | **str** | Type of validation rule. | [optional] [default to 'expression'] +**context_type** | **str** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **str** | Unique validation rule ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignments_count** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[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/ValidationRuleApplicableTo.md b/docs/ValidationRuleApplicableTo.md new file mode 100644 index 00000000..bc4ec31f --- /dev/null +++ b/docs/ValidationRuleApplicableTo.md @@ -0,0 +1,14 @@ +# ValidationRuleApplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**included_all** | **bool** | Indicates whether all items are included in the discount. | [optional] + +[[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/ValidationRuleAssignment.md b/docs/ValidationRuleAssignment.md new file mode 100644 index 00000000..fa1221ca --- /dev/null +++ b/docs/ValidationRuleAssignment.md @@ -0,0 +1,18 @@ +# ValidationRuleAssignment + +This is an object representing a validation rule assignment. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Validation rule assignment ID. | [optional] +**rule_id** | **str** | Validation rule ID. | [optional] +**related_object_id** | **str** | The resource ID to which the validation rule was assigned. | [optional] +**related_object_type** | **str** | The type of resource to which the validation rule was assigned. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the ID. | [optional] [default to 'validation_rules_assignment'] + +[[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/ValidationRuleAssignmentsList.md b/docs/ValidationRuleAssignmentsList.md new file mode 100644 index 00000000..ea86c874 --- /dev/null +++ b/docs/ValidationRuleAssignmentsList.md @@ -0,0 +1,16 @@ +# ValidationRuleAssignmentsList + +Validation Rule Assignments List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about validation rule assignments. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [optional] [default to 'data'] +**data** | [**List[ValidationRuleAssignment]**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | [optional] +**total** | **int** | Total number of validation rule assignments. | [optional] + +[[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/ValidationRuleError.md b/docs/ValidationRuleError.md new file mode 100644 index 00000000..967351bd --- /dev/null +++ b/docs/ValidationRuleError.md @@ -0,0 +1,13 @@ +# ValidationRuleError + +Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] + +[[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/ValidationRulesApi.md b/docs/ValidationRulesApi.md new file mode 100644 index 00000000..2fd354fe --- /dev/null +++ b/docs/ValidationRulesApi.md @@ -0,0 +1,820 @@ +# voucherify.ValidationRulesApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_validation_rule_assignment**](ValidationRulesApi.md#create_validation_rule_assignment) | **POST** /v1/validation-rules/{validationRuleId}/assignments | Create Validation Rules Assignments +[**create_validation_rules**](ValidationRulesApi.md#create_validation_rules) | **POST** /v1/validation-rules | Create Validation Rules +[**delete_validation_rule_assignment**](ValidationRulesApi.md#delete_validation_rule_assignment) | **DELETE** /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | Delete Validation Rule Assignment +[**delete_validation_rules**](ValidationRulesApi.md#delete_validation_rules) | **DELETE** /v1/validation-rules/{validationRuleId} | Delete Validation Rule +[**get_validation_rule**](ValidationRulesApi.md#get_validation_rule) | **GET** /v1/validation-rules/{validationRuleId} | Get Validation Rule +[**list_validation_rule_assignments**](ValidationRulesApi.md#list_validation_rule_assignments) | **GET** /v1/validation-rules/{validationRuleId}/assignments | List Validation Rule Assignments +[**list_validation_rules**](ValidationRulesApi.md#list_validation_rules) | **GET** /v1/validation-rules | List Validation Rules +[**list_validation_rules_assignments**](ValidationRulesApi.md#list_validation_rules_assignments) | **GET** /v1/validation-rules-assignments | List Validation Rules' Assignment(s) +[**update_validation_rule**](ValidationRulesApi.md#update_validation_rule) | **PUT** /v1/validation-rules/{validationRuleId} | Update Validation Rule + + +# **create_validation_rule_assignment** +> ValidationRulesAssignmentsCreateResponseBody create_validation_rule_assignment(validation_rule_id, force=force, validation_rules_assignments_create_request_body=validation_rules_assignments_create_request_body) + +Create Validation Rules Assignments + +Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.validation_rules_assignments_create_request_body import ValidationRulesAssignmentsCreateRequestBody +from voucherify.models.validation_rules_assignments_create_response_body import ValidationRulesAssignmentsCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + validation_rule_id = 'validation_rule_id_example' # str | Unique validation rule ID. + force = True # bool | If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. (optional) + validation_rules_assignments_create_request_body = {"voucher":"v_ssR6vhswwh5odSloN2Vc3O60w7aea018"} # ValidationRulesAssignmentsCreateRequestBody | Specify the resource that you would like to assign the validation rule to. (optional) + + try: + # Create Validation Rules Assignments + api_response = api_instance.create_validation_rule_assignment(validation_rule_id, force=force, validation_rules_assignments_create_request_body=validation_rules_assignments_create_request_body) + print("The response of ValidationRulesApi->create_validation_rule_assignment:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationRulesApi->create_validation_rule_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validation_rule_id** | **str**| Unique validation rule ID. | + **force** | **bool**| If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. | [optional] + **validation_rules_assignments_create_request_body** | [**ValidationRulesAssignmentsCreateRequestBody**](ValidationRulesAssignmentsCreateRequestBody.md)| Specify the resource that you would like to assign the validation rule to. | [optional] + +### Return type + +[**ValidationRulesAssignmentsCreateResponseBody**](ValidationRulesAssignmentsCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a validation rules assignment object. | - | + +[[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) + +# **create_validation_rules** +> ValidationRulesCreateResponseBody create_validation_rules(validation_rules_create_request_body=validation_rules_create_request_body) + +Create Validation Rules + +Create validation rules. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.validation_rules_create_request_body import ValidationRulesCreateRequestBody +from voucherify.models.validation_rules_create_response_body import ValidationRulesCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + validation_rules_create_request_body = {"name":"Set of Validation Rules","error":{"message":"Your order does not meet at least one of the required criteria."},"applicable_to":{"included_all":false,"excluded":[{"object":"product","id":"prod_0bae45ffc7003ffc52","source_id":"second_product","strict":false,"effect":"APPLY_TO_EVERY"}],"included":[{"object":"product","id":"prod_0b72b00ffed198e344","source_id":null,"effect":"APPLY_TO_MOST_EXPENSIVE","quantity_limit":1},{"object":"products_collection","id":"pc_4ndRXAsTOzwSdHcQcxf489uU","source_id":null,"effect":"APPLY_TO_EVERY","quantity_limit":5}]},"rules":{"1":{"name":"order.metadata","property":"location","rules":{},"conditions":{"$is":["Santorini"]},"error":{"message":"Your order must be placed at one of our Santorini shops."}},"2":{"name":"custom_event.metadata","property":"test","rules":{},"conditions":{"$greater_than_or_equal":[1]}},"3":{"name":"order.items.every","rules":{"1":{"name":"order.items.metadata","property":"test","rules":{},"conditions":{"$greater_than_or_equal":[1]}}},"conditions":{"$is":[{"id":"","effect":"APPLY_TO_EVERY","object":"product","source_id":""}]}},"logic":"1 or 2"}} # ValidationRulesCreateRequestBody | Specify the validation rules parameters. (optional) + + try: + # Create Validation Rules + api_response = api_instance.create_validation_rules(validation_rules_create_request_body=validation_rules_create_request_body) + print("The response of ValidationRulesApi->create_validation_rules:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationRulesApi->create_validation_rules: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validation_rules_create_request_body** | [**ValidationRulesCreateRequestBody**](ValidationRulesCreateRequestBody.md)| Specify the validation rules parameters. | [optional] + +### Return type + +[**ValidationRulesCreateResponseBody**](ValidationRulesCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a validation rule object. | - | + +[[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) + +# **delete_validation_rule_assignment** +> delete_validation_rule_assignment(validation_rule_id, assignment_id) + +Delete Validation Rule Assignment + +This method deletes a validation rule assignment. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + validation_rule_id = 'validation_rule_id_example' # str | A unique validation rule ID. + assignment_id = 'assignment_id_example' # str | A unique validation rule assignment ID. + + try: + # Delete Validation Rule Assignment + api_instance.delete_validation_rule_assignment(validation_rule_id, assignment_id) + except Exception as e: + print("Exception when calling ValidationRulesApi->delete_validation_rule_assignment: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validation_rule_id** | **str**| A unique validation rule ID. | + **assignment_id** | **str**| A unique validation rule assignment ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **delete_validation_rules** +> delete_validation_rules(validation_rule_id) + +Delete Validation Rule + +This method deletes a validation rule. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + validation_rule_id = 'validation_rule_id_example' # str | A unique validation rule ID. + + try: + # Delete Validation Rule + api_instance.delete_validation_rules(validation_rule_id) + except Exception as e: + print("Exception when calling ValidationRulesApi->delete_validation_rules: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validation_rule_id** | **str**| A unique validation rule ID. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **get_validation_rule** +> ValidationRulesGetResponseBody get_validation_rule(validation_rule_id) + +Get Validation Rule + +Retrieve the details of a validation rule. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.validation_rules_get_response_body import ValidationRulesGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + validation_rule_id = 'validation_rule_id_example' # str | A unique validation rule ID. + + try: + # Get Validation Rule + api_response = api_instance.get_validation_rule(validation_rule_id) + print("The response of ValidationRulesApi->get_validation_rule:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationRulesApi->get_validation_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validation_rule_id** | **str**| A unique validation rule ID. | + +### Return type + +[**ValidationRulesGetResponseBody**](ValidationRulesGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the validation rule object. | - | + +[[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) + +# **list_validation_rule_assignments** +> ValidationRulesAssignmentsListResponseBody list_validation_rule_assignments(validation_rule_id, limit=limit, page=page, order=order) + +List Validation Rule Assignments + +Retrieve validation rule assignments for a specific validation rule. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order_list_validation_rule_assignments import ParameterOrderListValidationRuleAssignments +from voucherify.models.validation_rules_assignments_list_response_body import ValidationRulesAssignmentsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + validation_rule_id = 'validation_rule_id_example' # str | Unique validation rule ID. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListValidationRuleAssignments() # ParameterOrderListValidationRuleAssignments | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Validation Rule Assignments + api_response = api_instance.list_validation_rule_assignments(validation_rule_id, limit=limit, page=page, order=order) + print("The response of ValidationRulesApi->list_validation_rule_assignments:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationRulesApi->list_validation_rule_assignments: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validation_rule_id** | **str**| Unique validation rule ID. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListValidationRuleAssignments**](.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**ValidationRulesAssignmentsListResponseBody**](ValidationRulesAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of validation rule assignments. If the validation rule ID provided in the path parameter cannot be found, the endpoint will return an empty `data` array and a total of `0`. | - | + +[[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) + +# **list_validation_rules** +> ValidationRulesListResponseBody list_validation_rules(limit=limit, page=page, order=order, start_date=start_date, end_date=end_date) + +List Validation Rules + +Retrieve validation rules. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order_list_validation_rules import ParameterOrderListValidationRules +from voucherify.models.validation_rules_list_response_body import ValidationRulesListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + order = voucherify.ParameterOrderListValidationRules() # ParameterOrderListValidationRules | This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + start_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. (optional) + end_date = '2013-10-20T19:20:30+01:00' # datetime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) + + try: + # List Validation Rules + api_response = api_instance.list_validation_rules(limit=limit, page=page, order=order, start_date=start_date, end_date=end_date) + print("The response of ValidationRulesApi->list_validation_rules:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationRulesApi->list_validation_rules: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **order** | [**ParameterOrderListValidationRules**](.md)| This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **start_date** | **datetime**| Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. | [optional] + **end_date** | **datetime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] + +### Return type + +[**ValidationRulesListResponseBody**](ValidationRulesListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of validation rules. | - | + +[[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) + +# **list_validation_rules_assignments** +> ValidationRulesAssignmentsListResponseBody list_validation_rules_assignments(related_object_id=related_object_id, rule=rule, page=page, limit=limit, order=order) + +List Validation Rules' Assignment(s) + +List all validation rules assignments or filter the results using the related object ID or the validation rule ID query parameters. # How to retrieve specific validation rule assignments(s) ## Related object ID To find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. ## Validation rule ID You can use the validation rule ID to find assignment(s) for a specific validation rule. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.validation_rules_assignments_list_response_body import ValidationRulesAssignmentsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + related_object_id = 'related_object_id_example' # str | The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. (optional) + rule = 'rule_example' # str | Validation rule ID. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = 'order_example' # str | Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. (optional) + + try: + # List Validation Rules' Assignment(s) + api_response = api_instance.list_validation_rules_assignments(related_object_id=related_object_id, rule=rule, page=page, limit=limit, order=order) + print("The response of ValidationRulesApi->list_validation_rules_assignments:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationRulesApi->list_validation_rules_assignments: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **related_object_id** | **str**| The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. | [optional] + **rule** | **str**| Validation rule ID. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | **str**| Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + +### Return type + +[**ValidationRulesAssignmentsListResponseBody**](ValidationRulesAssignmentsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary with a data property that contains an array of validation rule assignments. Each entry in the array is a separate object. If no more validation rule assignments are available, the resulting array will be empty. The result can be narrowed down according to default filters. | - | + +[[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) + +# **update_validation_rule** +> ValidationRulesUpdateResponseBody update_validation_rule(validation_rule_id, validation_rules_update_request_body=validation_rules_update_request_body) + +Update Validation Rule + +Update validation rule parameters. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.validation_rules_update_request_body import ValidationRulesUpdateRequestBody +from voucherify.models.validation_rules_update_response_body import ValidationRulesUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationRulesApi(api_client) + validation_rule_id = 'validation_rule_id_example' # str | A unique validation rule ID. + validation_rules_update_request_body = {"name":"Set of Validation Rules Updated","error":{"message":"Your orders do not meet at least one of the required criteria."},"applicable_to":{"included_all":false,"excluded":[{"object":"product","id":"prod_0bae45ffc7003ffccc","source_id":"second_product","strict":false,"effect":"APPLY_TO_EVERY"}],"included":[{"object":"product","id":"prod_0b72b00ffed198e333","source_id":null,"effect":"APPLY_TO_CHEAPEST","quantity_limit":1},{"object":"products_collection","id":"pc_4ndRXAsTOzwSdHcQcxf489uU","source_id":null,"effect":"APPLY_TO_EVERY","quantity_limit":5}]},"rules":{"1":{"name":"order.metadata","property":"place","rules":{},"conditions":{"$is":["Santorini"]},"error":{"message":"Your order must be placed at one of our Santorini shops on the beach."}},"2":{"name":"custom_event.metadata","property":"lining","rules":{},"conditions":{"$greater_than_or_equal":[1]}},"3":{"name":"order.items.every","rules":{"1":{"name":"order.items.metadata","property":"test","rules":{},"conditions":{"$greater_than_or_equal":[1]}}},"conditions":{"$is":[{"id":"","effect":"APPLY_TO_EVERY","object":"product","source_id":""}]}},"logic":"1 and 2"}} # ValidationRulesUpdateRequestBody | Specify the parameters to be updated. (optional) + + try: + # Update Validation Rule + api_response = api_instance.update_validation_rule(validation_rule_id, validation_rules_update_request_body=validation_rules_update_request_body) + print("The response of ValidationRulesApi->update_validation_rule:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationRulesApi->update_validation_rule: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validation_rule_id** | **str**| A unique validation rule ID. | + **validation_rules_update_request_body** | [**ValidationRulesUpdateRequestBody**](ValidationRulesUpdateRequestBody.md)| Specify the parameters to be updated. | [optional] + +### Return type + +[**ValidationRulesUpdateResponseBody**](ValidationRulesUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the validation rule object with the updated parameters. | - | + +[[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) + diff --git a/docs/ValidationRulesAssignmentsCreateRequestBody.md b/docs/ValidationRulesAssignmentsCreateRequestBody.md new file mode 100644 index 00000000..ef5e61af --- /dev/null +++ b/docs/ValidationRulesAssignmentsCreateRequestBody.md @@ -0,0 +1,14 @@ +# ValidationRulesAssignmentsCreateRequestBody + +Request body schema for **POST** `v1/validation-rules/{validationRuleId}/assignments`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**related_object_type** | **str** | Defines the related object, e.g. `voucher`. | [optional] [default to 'voucher'] +**related_object_id** | **str** | Unique related object ID assigned by Voucherify, e.g. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher. | [optional] + +[[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/ValidationRulesAssignmentsCreateResponseBody.md b/docs/ValidationRulesAssignmentsCreateResponseBody.md new file mode 100644 index 00000000..68b21e8a --- /dev/null +++ b/docs/ValidationRulesAssignmentsCreateResponseBody.md @@ -0,0 +1,18 @@ +# ValidationRulesAssignmentsCreateResponseBody + +Response body for **POST** `v1/validation-rules/{validationRuleId}/assignments`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Validation rule assignment ID. | [optional] +**rule_id** | **str** | Validation rule ID. | [optional] +**related_object_id** | **str** | The resource ID to which the validation rule was assigned. | [optional] +**related_object_type** | **str** | The type of resource to which the validation rule was assigned. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format. | [optional] +**object** | **str** | The type of the object represented by the ID. | [optional] [default to 'validation_rules_assignment'] + +[[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/ValidationRulesAssignmentsList.md b/docs/ValidationRulesAssignmentsList.md new file mode 100644 index 00000000..3a965535 --- /dev/null +++ b/docs/ValidationRulesAssignmentsList.md @@ -0,0 +1,16 @@ +# ValidationRulesAssignmentsList + +List of Validation Rules Assignments + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about validation rules assignments. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of validation rules assignments. | [optional] [default to 'data'] +**data** | [**List[BusValRuleAssignment]**](BusValRuleAssignment.md) | Contains array of validation rules assignments. | [optional] +**total** | **int** | Total number of validation rules assignments. | [optional] + +[[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/ValidationRulesAssignmentsListResponseBody.md b/docs/ValidationRulesAssignmentsListResponseBody.md new file mode 100644 index 00000000..00de9258 --- /dev/null +++ b/docs/ValidationRulesAssignmentsListResponseBody.md @@ -0,0 +1,16 @@ +# ValidationRulesAssignmentsListResponseBody + +Response body for **GET** `v1/validation-rules-assignments` and **GET** `v1/validation-rules/{validationRuleId}/assignments`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about validation rule assignments. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the JSON property that contains the array of validation rule assignments. | [optional] [default to 'data'] +**data** | [**List[ValidationRuleAssignment]**](ValidationRuleAssignment.md) | A dictionary that contains an array of validation rule assignments. | [optional] +**total** | **int** | Total number of validation rule assignments. | [optional] + +[[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/ValidationRulesCreateRequestBody.md b/docs/ValidationRulesCreateRequestBody.md new file mode 100644 index 00000000..4f6d6712 --- /dev/null +++ b/docs/ValidationRulesCreateRequestBody.md @@ -0,0 +1,18 @@ +# ValidationRulesCreateRequestBody + +Request body schema for **POST** `v1/validation-rules`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**ValidationRulesCreateRequestBodyError**](ValidationRulesCreateRequestBodyError.md) | | [optional] +**applicable_to** | [**ValidationRulesCreateRequestBodyApplicableTo**](ValidationRulesCreateRequestBodyApplicableTo.md) | | [optional] +**type** | **str** | Type of validation rule. | [optional] [default to 'expression'] +**context_type** | **str** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] + +[[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/ValidationRulesCreateRequestBodyApplicableTo.md b/docs/ValidationRulesCreateRequestBodyApplicableTo.md new file mode 100644 index 00000000..1224f021 --- /dev/null +++ b/docs/ValidationRulesCreateRequestBodyApplicableTo.md @@ -0,0 +1,14 @@ +# ValidationRulesCreateRequestBodyApplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**included_all** | **bool** | Indicates whether all items are included in the discount. | [optional] + +[[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/ValidationRulesCreateRequestBodyError.md b/docs/ValidationRulesCreateRequestBodyError.md new file mode 100644 index 00000000..7e5230d8 --- /dev/null +++ b/docs/ValidationRulesCreateRequestBodyError.md @@ -0,0 +1,13 @@ +# ValidationRulesCreateRequestBodyError + +Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] + +[[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/ValidationRulesCreateResponseBody.md b/docs/ValidationRulesCreateResponseBody.md new file mode 100644 index 00000000..1509fdd8 --- /dev/null +++ b/docs/ValidationRulesCreateResponseBody.md @@ -0,0 +1,23 @@ +# ValidationRulesCreateResponseBody + +Response body schema for **POST** `v1/validation-rules`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**ValidationRulesCreateResponseBodyError**](ValidationRulesCreateResponseBodyError.md) | | [optional] +**applicable_to** | [**ValidationRulesCreateResponseBodyApplicableTo**](ValidationRulesCreateResponseBodyApplicableTo.md) | | [optional] +**type** | **str** | Type of validation rule. | [optional] [default to 'expression'] +**context_type** | **str** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **str** | Unique validation rule ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignments_count** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[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/ValidationRulesCreateResponseBodyApplicableTo.md b/docs/ValidationRulesCreateResponseBodyApplicableTo.md new file mode 100644 index 00000000..88efb297 --- /dev/null +++ b/docs/ValidationRulesCreateResponseBodyApplicableTo.md @@ -0,0 +1,14 @@ +# ValidationRulesCreateResponseBodyApplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**included_all** | **bool** | Indicates whether all items are included in the discount. | [optional] + +[[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/ValidationRulesCreateResponseBodyError.md b/docs/ValidationRulesCreateResponseBodyError.md new file mode 100644 index 00000000..9ffa5f21 --- /dev/null +++ b/docs/ValidationRulesCreateResponseBodyError.md @@ -0,0 +1,13 @@ +# ValidationRulesCreateResponseBodyError + +Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] + +[[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/ValidationRulesGetResponseBody.md b/docs/ValidationRulesGetResponseBody.md new file mode 100644 index 00000000..1aa68068 --- /dev/null +++ b/docs/ValidationRulesGetResponseBody.md @@ -0,0 +1,23 @@ +# ValidationRulesGetResponseBody + +Response body schema for **GET** `v1/validation-rules/{validationRuleId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**ValidationRulesGetResponseBodyError**](ValidationRulesGetResponseBodyError.md) | | [optional] +**applicable_to** | [**ValidationRulesGetResponseBodyApplicableTo**](ValidationRulesGetResponseBodyApplicableTo.md) | | [optional] +**type** | **str** | Type of validation rule. | [optional] [default to 'expression'] +**context_type** | **str** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **str** | Unique validation rule ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignments_count** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[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/ValidationRulesGetResponseBodyApplicableTo.md b/docs/ValidationRulesGetResponseBodyApplicableTo.md new file mode 100644 index 00000000..8f0486d3 --- /dev/null +++ b/docs/ValidationRulesGetResponseBodyApplicableTo.md @@ -0,0 +1,14 @@ +# ValidationRulesGetResponseBodyApplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**included_all** | **bool** | Indicates whether all items are included in the discount. | [optional] + +[[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/ValidationRulesGetResponseBodyError.md b/docs/ValidationRulesGetResponseBodyError.md new file mode 100644 index 00000000..5cf06021 --- /dev/null +++ b/docs/ValidationRulesGetResponseBodyError.md @@ -0,0 +1,13 @@ +# ValidationRulesGetResponseBodyError + +Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] + +[[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/ValidationRulesListResponseBody.md b/docs/ValidationRulesListResponseBody.md new file mode 100644 index 00000000..a18275b4 --- /dev/null +++ b/docs/ValidationRulesListResponseBody.md @@ -0,0 +1,16 @@ +# ValidationRulesListResponseBody + +Response body schema for **GET** `v1/validation-rules`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. This object stores information about validation rules. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of validation rules. | [optional] [default to 'data'] +**data** | [**List[ValidationRule]**](ValidationRule.md) | An array of validation rules. | [optional] +**total** | **int** | Total number of validation rules in the project. | [optional] + +[[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/ValidationRulesUpdateRequestBody.md b/docs/ValidationRulesUpdateRequestBody.md new file mode 100644 index 00000000..284b4fe9 --- /dev/null +++ b/docs/ValidationRulesUpdateRequestBody.md @@ -0,0 +1,18 @@ +# ValidationRulesUpdateRequestBody + +Response body schema for **PUT** `v1/validation-rules/{validationRuleId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**ValidationRulesUpdateRequestBodyError**](ValidationRulesUpdateRequestBodyError.md) | | [optional] +**applicable_to** | [**ValidationRulesUpdateRequestBodyApplicableTo**](ValidationRulesUpdateRequestBodyApplicableTo.md) | | [optional] +**type** | **str** | Type of validation rule. | [optional] [default to 'expression'] +**context_type** | **str** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] + +[[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/ValidationRulesUpdateRequestBodyApplicableTo.md b/docs/ValidationRulesUpdateRequestBodyApplicableTo.md new file mode 100644 index 00000000..69c739bf --- /dev/null +++ b/docs/ValidationRulesUpdateRequestBodyApplicableTo.md @@ -0,0 +1,14 @@ +# ValidationRulesUpdateRequestBodyApplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**included_all** | **bool** | Indicates whether all items are included in the discount. | [optional] + +[[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/ValidationRulesUpdateRequestBodyError.md b/docs/ValidationRulesUpdateRequestBodyError.md new file mode 100644 index 00000000..b78fdf57 --- /dev/null +++ b/docs/ValidationRulesUpdateRequestBodyError.md @@ -0,0 +1,13 @@ +# ValidationRulesUpdateRequestBodyError + +Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] + +[[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/ValidationRulesUpdateResponseBody.md b/docs/ValidationRulesUpdateResponseBody.md new file mode 100644 index 00000000..380b94e2 --- /dev/null +++ b/docs/ValidationRulesUpdateResponseBody.md @@ -0,0 +1,23 @@ +# ValidationRulesUpdateResponseBody + +Response body schema for **PUT** `v1/validation-rules/{validationRuleId}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Custom, unique name for set of validation rules. | [optional] +**rules** | **object** | Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions. | [optional] +**error** | [**ValidationRulesUpdateResponseBodyError**](ValidationRulesUpdateResponseBodyError.md) | | [optional] +**applicable_to** | [**ValidationRulesUpdateResponseBodyApplicableTo**](ValidationRulesUpdateResponseBodyApplicableTo.md) | | [optional] +**type** | **str** | Type of validation rule. | [optional] [default to 'expression'] +**context_type** | **str** | Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | | | [optional] [default to 'global'] +**id** | **str** | Unique validation rule ID. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format. | [optional] +**assignments_count** | **int** | The number of instances the validation rule has been assigned to different types of redeemables. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about the validation rule. | [optional] [default to 'validation_rules'] + +[[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/ValidationRulesUpdateResponseBodyApplicableTo.md b/docs/ValidationRulesUpdateResponseBodyApplicableTo.md new file mode 100644 index 00000000..796dd1d0 --- /dev/null +++ b/docs/ValidationRulesUpdateResponseBodyApplicableTo.md @@ -0,0 +1,14 @@ +# ValidationRulesUpdateResponseBodyApplicableTo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**excluded** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are excluded from a discount. | [optional] +**included** | [**List[ApplicableTo]**](ApplicableTo.md) | Defines which items are included in a discount. | [optional] +**included_all** | **bool** | Indicates whether all items are included in the discount. | [optional] + +[[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/ValidationRulesUpdateResponseBodyError.md b/docs/ValidationRulesUpdateResponseBodyError.md new file mode 100644 index 00000000..43ee2c25 --- /dev/null +++ b/docs/ValidationRulesUpdateResponseBodyError.md @@ -0,0 +1,13 @@ +# ValidationRulesUpdateResponseBodyError + +Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | The error message returned from API when validation / redemption fails to meet requirements of defined rules. | [optional] + +[[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/ValidationsApi.md b/docs/ValidationsApi.md new file mode 100644 index 00000000..34349596 --- /dev/null +++ b/docs/ValidationsApi.md @@ -0,0 +1,96 @@ +# voucherify.ValidationsApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**validate_stacked_discounts**](ValidationsApi.md#validate_stacked_discounts) | **POST** /v1/validations | Validate Stackable Discounts + + +# **validate_stacked_discounts** +> ValidationsValidateResponseBody validate_stacked_discounts(validations_validate_request_body=validations_validate_request_body) + +Validate Stackable Discounts + +Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.validations_validate_request_body import ValidationsValidateRequestBody +from voucherify.models.validations_validate_response_body import ValidationsValidateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.ValidationsApi(api_client) + validations_validate_request_body = {"customer":{"source_id":"sample_customer","metadata":{"key":"value"}},"options":{"expand":["order","redeemable","category"]},"redeemables":[{"object":"voucher","id":"voucher-code"}],"session":{"type":"LOCK"},"order":{"amount":55000,"status":"PAID","items":[{"quantity":2,"price":20000,"source_id":"sample product1","related_object":"product","product":{"metadata":{"key":"value"}}},{"quantity":1,"price":15000,"source_id":"sample product2","related_object":"product","product":{"metadata":{"key":"value"}}}],"metadata":{"key":"value"}}} # ValidationsValidateRequestBody | (optional) + + try: + # Validate Stackable Discounts + api_response = api_instance.validate_stacked_discounts(validations_validate_request_body=validations_validate_request_body) + print("The response of ValidationsApi->validate_stacked_discounts:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ValidationsApi->validate_stacked_discounts: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **validations_validate_request_body** | [**ValidationsValidateRequestBody**](ValidationsValidateRequestBody.md)| | [optional] + +### Return type + +[**ValidationsValidateResponseBody**](ValidationsValidateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Depending on your project settings: all redeemables must be valid or just one must be valid to result as valid validation. See https://support.voucherify.io/article/604-stacking-rules#application-rules | - | + +[[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) + diff --git a/docs/ValidationsRedeemableInapplicable.md b/docs/ValidationsRedeemableInapplicable.md new file mode 100644 index 00000000..68c8bb04 --- /dev/null +++ b/docs/ValidationsRedeemableInapplicable.md @@ -0,0 +1,17 @@ +# ValidationsRedeemableInapplicable + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **str** | Indicates whether the redeemable can be applied or not applied based on the validation rules. | [optional] [default to 'INAPPLICABLE'] +**id** | **str** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **str** | Redeemable's object type. | [optional] +**result** | [**ValidationsRedeemableInapplicableResult**](ValidationsRedeemableInapplicableResult.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/ValidationsRedeemableInapplicableResult.md b/docs/ValidationsRedeemableInapplicableResult.md new file mode 100644 index 00000000..7bf708ae --- /dev/null +++ b/docs/ValidationsRedeemableInapplicableResult.md @@ -0,0 +1,14 @@ +# ValidationsRedeemableInapplicableResult + +Includes the error object with details about the reason why the redeemable is inapplicable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**Error**](Error.md) | | [optional] +**details** | [**ValidationsRedeemableInapplicableResultDetails**](ValidationsRedeemableInapplicableResultDetails.md) | | [optional] + +[[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/ValidationsRedeemableInapplicableResultDetails.md b/docs/ValidationsRedeemableInapplicableResultDetails.md new file mode 100644 index 00000000..57b851c0 --- /dev/null +++ b/docs/ValidationsRedeemableInapplicableResultDetails.md @@ -0,0 +1,14 @@ +# ValidationsRedeemableInapplicableResultDetails + +Provides details about the reason why the redeemable is inapplicable. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | Generic message from the `message` string shown in the `error` object or the message configured in a validation rule. | [optional] +**key** | **str** | Generic message from the `key` string shown in the `error` object. | [optional] + +[[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/ValidationsRedeemableSkipped.md b/docs/ValidationsRedeemableSkipped.md new file mode 100644 index 00000000..f4f49291 --- /dev/null +++ b/docs/ValidationsRedeemableSkipped.md @@ -0,0 +1,17 @@ +# ValidationsRedeemableSkipped + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **str** | Indicates whether the redeemable can be applied or not applied based on the validation rules. | [optional] [default to 'SKIPPED'] +**id** | **str** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **str** | Redeemable's object type. | [optional] +**result** | [**ValidationsRedeemableSkippedResult**](ValidationsRedeemableSkippedResult.md) | | [optional] +**metadata** | **object** | The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable. | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/ValidationsRedeemableSkippedResult.md b/docs/ValidationsRedeemableSkippedResult.md new file mode 100644 index 00000000..b180b2a3 --- /dev/null +++ b/docs/ValidationsRedeemableSkippedResult.md @@ -0,0 +1,13 @@ +# ValidationsRedeemableSkippedResult + +Provides details about the reason why the redeemable is skipped. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**details** | [**ValidationsRedeemableSkippedResultDetails**](ValidationsRedeemableSkippedResultDetails.md) | | [optional] + +[[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/ValidationsRedeemableSkippedResultDetails.md b/docs/ValidationsRedeemableSkippedResultDetails.md new file mode 100644 index 00000000..2deeaee2 --- /dev/null +++ b/docs/ValidationsRedeemableSkippedResultDetails.md @@ -0,0 +1,13 @@ +# ValidationsRedeemableSkippedResultDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **str** | | [optional] +**message** | **str** | | [optional] + +[[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/ValidationsValidateRequestBody.md b/docs/ValidationsValidateRequestBody.md new file mode 100644 index 00000000..8e371438 --- /dev/null +++ b/docs/ValidationsValidateRequestBody.md @@ -0,0 +1,19 @@ +# ValidationsValidateRequestBody + +Response body schema for **POST** `v1/validations`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**options** | [**ValidationsValidateRequestBodyOptions**](ValidationsValidateRequestBodyOptions.md) | | [optional] +**redeemables** | [**List[ValidationsValidateRequestBodyRedeemablesItem]**](ValidationsValidateRequestBodyRedeemablesItem.md) | | [optional] +**order** | [**Order**](Order.md) | | [optional] +**customer** | [**Customer**](Customer.md) | | [optional] +**session** | [**Session**](Session.md) | | [optional] +**tracking_id** | **str** | Is correspondent to Customer's source_id | [optional] +**metadata** | **object** | A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format. | [optional] + +[[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/ValidationsValidateRequestBodyOptions.md b/docs/ValidationsValidateRequestBodyOptions.md new file mode 100644 index 00000000..0ab5fa1f --- /dev/null +++ b/docs/ValidationsValidateRequestBodyOptions.md @@ -0,0 +1,13 @@ +# ValidationsValidateRequestBodyOptions + +Configure parameters returned in the response. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**expand** | **List[str]** | The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).<br>- Order data with calculated discounts are listed in each child redeemable object.<br>- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.<br>- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [optional] + +[[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/ValidationsValidateRequestBodyRedeemablesItem.md b/docs/ValidationsValidateRequestBodyRedeemablesItem.md new file mode 100644 index 00000000..e445844f --- /dev/null +++ b/docs/ValidationsValidateRequestBodyRedeemablesItem.md @@ -0,0 +1,15 @@ +# ValidationsValidateRequestBodyRedeemablesItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | | [optional] +**id** | **str** | | [optional] +**gift** | [**ValidationsValidateRequestBodyRedeemablesItemGift**](ValidationsValidateRequestBodyRedeemablesItemGift.md) | | [optional] +**reward** | [**ValidationsValidateRequestBodyRedeemablesItemReward**](ValidationsValidateRequestBodyRedeemablesItemReward.md) | | [optional] + +[[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/ValidationsValidateRequestBodyRedeemablesItemGift.md b/docs/ValidationsValidateRequestBodyRedeemablesItemGift.md new file mode 100644 index 00000000..257ac2f1 --- /dev/null +++ b/docs/ValidationsValidateRequestBodyRedeemablesItemGift.md @@ -0,0 +1,13 @@ +# ValidationsValidateRequestBodyRedeemablesItemGift + +Contains information on the number of gift card credits that the customer wants to apply to the order. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`. | [optional] + +[[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/ValidationsValidateRequestBodyRedeemablesItemReward.md b/docs/ValidationsValidateRequestBodyRedeemablesItemReward.md new file mode 100644 index 00000000..b211589f --- /dev/null +++ b/docs/ValidationsValidateRequestBodyRedeemablesItemReward.md @@ -0,0 +1,14 @@ +# ValidationsValidateRequestBodyRedeemablesItemReward + +Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward. | [optional] +**points** | **int** | The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card. | [optional] + +[[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/ValidationsValidateResponseBody.md b/docs/ValidationsValidateResponseBody.md new file mode 100644 index 00000000..fe9c6c18 --- /dev/null +++ b/docs/ValidationsValidateResponseBody.md @@ -0,0 +1,20 @@ +# ValidationsValidateResponseBody + +Response body schema for POST `/validations`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**valid** | **bool** | The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable. | [optional] +**redeemables** | [**List[ValidationsValidateResponseBodyRedeemablesItem]**](ValidationsValidateResponseBodyRedeemablesItem.md) | | [optional] +**skipped_redeemables** | [**List[ValidationsRedeemableSkipped]**](ValidationsRedeemableSkipped.md) | Lists validation results of each skipped redeemable. | [optional] +**inapplicable_redeemables** | [**List[ValidationsRedeemableInapplicable]**](ValidationsRedeemableInapplicable.md) | Lists validation results of each inapplicable redeemable. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**tracking_id** | **str** | Hashed customer source ID. | [optional] +**session** | [**Session**](Session.md) | | [optional] +**stacking_rules** | [**StackingRules**](StackingRules.md) | | + +[[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/ValidationsValidateResponseBodyRedeemablesItem.md b/docs/ValidationsValidateResponseBodyRedeemablesItem.md new file mode 100644 index 00000000..0ee7e7c5 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItem.md @@ -0,0 +1,20 @@ +# ValidationsValidateResponseBodyRedeemablesItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **str** | | [optional] +**id** | **str** | Redeemable ID, i.e. the voucher code. | [optional] +**object** | **str** | Redeemable's object type. | [optional] +**order** | [**OrderCalculated**](OrderCalculated.md) | | [optional] +**applicable_to** | [**ApplicableToResultList**](ApplicableToResultList.md) | | [optional] +**inapplicable_to** | [**InapplicableToResultList**](InapplicableToResultList.md) | | [optional] +**result** | [**ValidationsValidateResponseBodyRedeemablesItemResult**](ValidationsValidateResponseBodyRedeemablesItemResult.md) | | [optional] +**metadata** | **object** | | [optional] +**categories** | [**List[Category]**](Category.md) | | [optional] + +[[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/ValidationsValidateResponseBodyRedeemablesItemResult.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResult.md new file mode 100644 index 00000000..b5d3684b --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResult.md @@ -0,0 +1,16 @@ +# ValidationsValidateResponseBodyRedeemablesItemResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**discount** | [**ValidationsValidateResponseBodyRedeemablesItemResultDiscount**](ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md) | | [optional] +**gift** | [**ValidationsValidateResponseBodyRedeemablesItemResultGift**](ValidationsValidateResponseBodyRedeemablesItemResultGift.md) | | [optional] +**loyalty_card** | [**ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard**](ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md) | | [optional] +**error** | [**Error**](Error.md) | | [optional] +**details** | [**ValidationsValidateResponseBodyRedeemablesItemResultDetails**](ValidationsValidateResponseBodyRedeemablesItemResultDetails.md) | | [optional] + +[[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/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md new file mode 100644 index 00000000..a969ad3d --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDetails.md @@ -0,0 +1,13 @@ +# ValidationsValidateResponseBodyRedeemablesItemResultDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **str** | | [optional] +**message** | **str** | | [optional] + +[[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/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md new file mode 100644 index 00000000..33f4e28d --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md @@ -0,0 +1,28 @@ +# ValidationsValidateResponseBodyRedeemablesItemResultDiscount + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**amount_off** | **float** | Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. | [optional] +**amount_off_formula** | **str** | | [optional] +**aggregated_amount_limit** | **int** | Maximum discount amount per order. | [optional] +**effect** | **str** | | [optional] +**is_dynamic** | **bool** | Flag indicating whether the discount was calculated using a formula. | [optional] +**unit_off** | **int** | Number of units to be granted a full value discount. | [optional] +**unit_off_formula** | **str** | | [optional] +**unit_type** | **str** | The product deemed as free, chosen from product inventory (e.g. time, items). | [optional] +**product** | [**ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct**](ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md) | | [optional] +**sku** | [**SimpleSkuDiscountUnit**](SimpleSkuDiscountUnit.md) | | [optional] +**units** | [**List[DiscountUnitMultipleOneUnit]**](DiscountUnitMultipleOneUnit.md) | | [optional] +**percent_off** | **float** | The percent discount that the customer will receive. | [optional] +**percent_off_formula** | **str** | | [optional] +**amount_limit** | **float** | Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600. | [optional] +**fixed_amount** | **float** | Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value. | [optional] +**fixed_amount_formula** | **str** | | [optional] + +[[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/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md new file mode 100644 index 00000000..0dc02218 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.md @@ -0,0 +1,14 @@ +# ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique product ID, assigned by Voucherify. | [optional] +**source_id** | **str** | Product's source ID. | [optional] +**name** | **str** | Product name. | [optional] + +[[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/ValidationsValidateResponseBodyRedeemablesItemResultGift.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultGift.md new file mode 100644 index 00000000..8f6d91b1 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultGift.md @@ -0,0 +1,13 @@ +# ValidationsValidateResponseBodyRedeemablesItemResultGift + +Stores the amount of gift card credits to be applied in the redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**credits** | **int** | Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00). | [optional] + +[[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/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md b/docs/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md new file mode 100644 index 00000000..c75363a4 --- /dev/null +++ b/docs/ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.md @@ -0,0 +1,12 @@ +# ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total number of loyalty points to be applied in the redemption. | [optional] + +[[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/ValidityHours.md b/docs/ValidityHours.md new file mode 100644 index 00000000..b8d84fea --- /dev/null +++ b/docs/ValidityHours.md @@ -0,0 +1,13 @@ +# ValidityHours + +Determines the hours of validity, e.g. to create a happy hours scenario. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**daily** | [**List[ValidityHoursDailyItem]**](ValidityHoursDailyItem.md) | Defines the reccuring period(s) when the resource is active. The periods should not overlap. | [optional] + +[[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/ValidityHoursDailyItem.md b/docs/ValidityHoursDailyItem.md new file mode 100644 index 00000000..f9bb3e13 --- /dev/null +++ b/docs/ValidityHoursDailyItem.md @@ -0,0 +1,15 @@ +# ValidityHoursDailyItem + +Defines the reccuring period(s) when the resource will be active. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_time** | **str** | Defines the starting hour of validity in the HH:mm format. The resource is *inactive before* this time. | [optional] +**days_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the resource is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**expiration_time** | **str** | Defines the ending hour of validity in the HH:mm format. The resource is *inactive after* this time. | [optional] + +[[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/ValidityTimeframe.md b/docs/ValidityTimeframe.md new file mode 100644 index 00000000..9b876937 --- /dev/null +++ b/docs/ValidityTimeframe.md @@ -0,0 +1,14 @@ +# ValidityTimeframe + +Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration** | **str** | Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour. | [optional] +**interval** | **str** | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day. | [optional] + +[[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/Voucher.md b/docs/Voucher.md new file mode 100644 index 00000000..85a55e8d --- /dev/null +++ b/docs/Voucher.md @@ -0,0 +1,41 @@ +# Voucher + +This is an object representing a voucher with categories and validation rules assignments. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**VoucherGift**](VoucherGift.md) | | [optional] +**loyalty_card** | [**VoucherLoyaltyCard**](VoucherLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**VoucherPublish**](VoucherPublish.md) | | [optional] +**redemption** | [**VoucherRedemption**](VoucherRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/VoucherAssets.md b/docs/VoucherAssets.md new file mode 100644 index 00000000..d7a24be4 --- /dev/null +++ b/docs/VoucherAssets.md @@ -0,0 +1,14 @@ +# VoucherAssets + +Stores links to images of QR and barcode that correspond to an encrypted voucher code. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**qr** | [**VoucherAssetsQr**](VoucherAssetsQr.md) | | [optional] +**barcode** | [**VoucherAssetsBarcode**](VoucherAssetsBarcode.md) | | [optional] + +[[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/VoucherAssetsBarcode.md b/docs/VoucherAssetsBarcode.md new file mode 100644 index 00000000..868f5502 --- /dev/null +++ b/docs/VoucherAssetsBarcode.md @@ -0,0 +1,14 @@ +# VoucherAssetsBarcode + +Stores barcode representation of encrypted code. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Encrypted voucher code ID. | [optional] +**url** | **str** | URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[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/VoucherAssetsQr.md b/docs/VoucherAssetsQr.md new file mode 100644 index 00000000..a73da9d6 --- /dev/null +++ b/docs/VoucherAssetsQr.md @@ -0,0 +1,14 @@ +# VoucherAssetsQr + +Stores Quick Response (QR) representation of encrypted code. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Encrypted voucher code ID. | [optional] +**url** | **str** | URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg` | [optional] + +[[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/VoucherGift.md b/docs/VoucherGift.md new file mode 100644 index 00000000..625e9320 --- /dev/null +++ b/docs/VoucherGift.md @@ -0,0 +1,15 @@ +# VoucherGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/VoucherLoyaltyCard.md b/docs/VoucherLoyaltyCard.md new file mode 100644 index 00000000..e0a08a01 --- /dev/null +++ b/docs/VoucherLoyaltyCard.md @@ -0,0 +1,16 @@ +# VoucherLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/VoucherPublish.md b/docs/VoucherPublish.md new file mode 100644 index 00000000..ea46c0cf --- /dev/null +++ b/docs/VoucherPublish.md @@ -0,0 +1,15 @@ +# VoucherPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/VoucherRedemption.md b/docs/VoucherRedemption.md new file mode 100644 index 00000000..63f6808a --- /dev/null +++ b/docs/VoucherRedemption.md @@ -0,0 +1,17 @@ +# VoucherRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/VoucherTransaction.md b/docs/VoucherTransaction.md new file mode 100644 index 00000000..92027ecb --- /dev/null +++ b/docs/VoucherTransaction.md @@ -0,0 +1,21 @@ +# VoucherTransaction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique transaction ID. | [optional] +**source_id** | **str** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null. | [optional] +**voucher_id** | **str** | Unique voucher ID. | [optional] +**campaign_id** | **str** | Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes. | [optional] +**source** | **str** | The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null. | [optional] +**reason** | **str** | Reason why the transaction occurred. In case of a redemption, this value is null. | [optional] +**type** | [**LoyaltyCardTransactionsType**](LoyaltyCardTransactionsType.md) | | +**details** | [**VoucherTransactionDetails**](VoucherTransactionDetails.md) | | [optional] +**related_transaction_id** | **str** | The related transaction ID on the receiving card. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format. | [optional] + +[[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/VoucherTransactionDetails.md b/docs/VoucherTransactionDetails.md new file mode 100644 index 00000000..1a301e91 --- /dev/null +++ b/docs/VoucherTransactionDetails.md @@ -0,0 +1,25 @@ +# VoucherTransactionDetails + +Contains the detailed information about the transaction. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**balance** | [**VoucherTransactionDetailsBalance**](VoucherTransactionDetailsBalance.md) | | [optional] +**order** | [**VoucherTransactionDetailsOrder**](VoucherTransactionDetailsOrder.md) | | [optional] +**event** | [**VoucherTransactionDetailsEvent**](VoucherTransactionDetailsEvent.md) | | [optional] +**earning_rule** | [**VoucherTransactionDetailsEarningRule**](VoucherTransactionDetailsEarningRule.md) | | [optional] +**segment** | [**VoucherTransactionDetailsSegment**](VoucherTransactionDetailsSegment.md) | | [optional] +**loyalty_tier** | [**VoucherTransactionDetailsLoyaltyTier**](VoucherTransactionDetailsLoyaltyTier.md) | | [optional] +**redemption** | [**VoucherTransactionDetailsRedemption**](VoucherTransactionDetailsRedemption.md) | | [optional] +**rollback** | [**VoucherTransactionDetailsRollback**](VoucherTransactionDetailsRollback.md) | | [optional] +**custom_event** | [**VoucherTransactionDetailsCustomEvent**](VoucherTransactionDetailsCustomEvent.md) | | [optional] +**event_schema** | [**VoucherTransactionDetailsEventSchema**](VoucherTransactionDetailsEventSchema.md) | | [optional] +**reward** | [**VoucherTransactionDetailsReward**](VoucherTransactionDetailsReward.md) | | [optional] +**source_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] +**destination_voucher** | [**SimpleVoucher**](SimpleVoucher.md) | | [optional] + +[[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/VoucherTransactionDetailsBalance.md b/docs/VoucherTransactionDetailsBalance.md new file mode 100644 index 00000000..6068def5 --- /dev/null +++ b/docs/VoucherTransactionDetailsBalance.md @@ -0,0 +1,18 @@ +# VoucherTransactionDetailsBalance + +Contains information on how the balance was affected by the transaction. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The type of voucher whose balance is being adjusted due to the transaction. | [optional] [default to 'loyalty_card'] +**total** | **int** | The number of all points accumulated on the card as affected by add or subtract operations. | [optional] +**object** | **str** | The type of the object represented by the JSON. | [optional] [default to 'balance'] +**points** | **int** | Points added or subtracted in the transaction. | [optional] +**balance** | **int** | The available points on the card after the transaction as affected by redemption or rollback. | [optional] +**related_object** | [**VoucherTransactionDetailsBalanceRelatedObject**](VoucherTransactionDetailsBalanceRelatedObject.md) | | [optional] + +[[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/VoucherTransactionDetailsBalanceRelatedObject.md b/docs/VoucherTransactionDetailsBalanceRelatedObject.md new file mode 100644 index 00000000..6800a51d --- /dev/null +++ b/docs/VoucherTransactionDetailsBalanceRelatedObject.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsBalanceRelatedObject + +Defines the resource that is being modified with the values that are returned in the balance object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] +**type** | **str** | The object being modified, i.e. voucher. | [optional] [default to 'voucher'] + +[[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/VoucherTransactionDetailsCustomEvent.md b/docs/VoucherTransactionDetailsCustomEvent.md new file mode 100644 index 00000000..5994eb3f --- /dev/null +++ b/docs/VoucherTransactionDetailsCustomEvent.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsCustomEvent + +Contains information about the custom event that triggers the point accrual. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique event ID. | [optional] +**type** | **str** | Type of custom event. | [optional] + +[[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/VoucherTransactionDetailsEarningRule.md b/docs/VoucherTransactionDetailsEarningRule.md new file mode 100644 index 00000000..f41a2f36 --- /dev/null +++ b/docs/VoucherTransactionDetailsEarningRule.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsEarningRule + +Contains information about the earning rule. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique earning rule ID. | [optional] +**source** | [**VoucherTransactionDetailsEarningRuleSource**](VoucherTransactionDetailsEarningRuleSource.md) | | [optional] + +[[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/VoucherTransactionDetailsEarningRuleSource.md b/docs/VoucherTransactionDetailsEarningRuleSource.md new file mode 100644 index 00000000..cbf7f3a4 --- /dev/null +++ b/docs/VoucherTransactionDetailsEarningRuleSource.md @@ -0,0 +1,13 @@ +# VoucherTransactionDetailsEarningRuleSource + +Contains the custom earning rule name. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**banner** | **str** | Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. | [optional] + +[[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/VoucherTransactionDetailsEvent.md b/docs/VoucherTransactionDetailsEvent.md new file mode 100644 index 00000000..b4c0127a --- /dev/null +++ b/docs/VoucherTransactionDetailsEvent.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsEvent + +Contains information about the event that triggers the point accrual. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique event ID. | [optional] +**type** | **str** | Type of event. | [optional] + +[[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/VoucherTransactionDetailsEventSchema.md b/docs/VoucherTransactionDetailsEventSchema.md new file mode 100644 index 00000000..4eed62be --- /dev/null +++ b/docs/VoucherTransactionDetailsEventSchema.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsEventSchema + +Contains information about the custom event metadata schema. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique metadata schema ID. | [optional] +**name** | **str** | Type of custom event. | [optional] + +[[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/VoucherTransactionDetailsLoyaltyTier.md b/docs/VoucherTransactionDetailsLoyaltyTier.md new file mode 100644 index 00000000..f9994663 --- /dev/null +++ b/docs/VoucherTransactionDetailsLoyaltyTier.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsLoyaltyTier + +Contains information about the loyalty tier. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**name** | **str** | | [optional] + +[[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/VoucherTransactionDetailsOrder.md b/docs/VoucherTransactionDetailsOrder.md new file mode 100644 index 00000000..0943af4f --- /dev/null +++ b/docs/VoucherTransactionDetailsOrder.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsOrder + +Contains information about the original order. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique order ID. | [optional] +**source_id** | **str** | The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | [optional] + +[[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/VoucherTransactionDetailsRedemption.md b/docs/VoucherTransactionDetailsRedemption.md new file mode 100644 index 00000000..899ba008 --- /dev/null +++ b/docs/VoucherTransactionDetailsRedemption.md @@ -0,0 +1,13 @@ +# VoucherTransactionDetailsRedemption + +Contains information about the original redemption. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption ID. | [optional] + +[[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/VoucherTransactionDetailsReward.md b/docs/VoucherTransactionDetailsReward.md new file mode 100644 index 00000000..293747ce --- /dev/null +++ b/docs/VoucherTransactionDetailsReward.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsReward + +Contains information about the pay with points reward. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique reward ID. | [optional] +**name** | **str** | Reward name. | [optional] + +[[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/VoucherTransactionDetailsRollback.md b/docs/VoucherTransactionDetailsRollback.md new file mode 100644 index 00000000..62a7d616 --- /dev/null +++ b/docs/VoucherTransactionDetailsRollback.md @@ -0,0 +1,13 @@ +# VoucherTransactionDetailsRollback + +Contains information about the redemption rollback. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique redemption rollback ID. | [optional] + +[[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/VoucherTransactionDetailsSegment.md b/docs/VoucherTransactionDetailsSegment.md new file mode 100644 index 00000000..f97dda28 --- /dev/null +++ b/docs/VoucherTransactionDetailsSegment.md @@ -0,0 +1,14 @@ +# VoucherTransactionDetailsSegment + +Contains information about the segment. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**name** | **str** | | [optional] + +[[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/VoucherTransactionsExportFilterConditions.md b/docs/VoucherTransactionsExportFilterConditions.md new file mode 100644 index 00000000..1fec6d99 --- /dev/null +++ b/docs/VoucherTransactionsExportFilterConditions.md @@ -0,0 +1,13 @@ +# VoucherTransactionsExportFilterConditions + +Filter condition. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**voucher_id** | [**VoucherTransactionsExportFilterConditionsVoucherId**](VoucherTransactionsExportFilterConditionsVoucherId.md) | | [optional] + +[[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/VoucherTransactionsExportFilterConditionsVoucherId.md b/docs/VoucherTransactionsExportFilterConditionsVoucherId.md new file mode 100644 index 00000000..b46afa55 --- /dev/null +++ b/docs/VoucherTransactionsExportFilterConditionsVoucherId.md @@ -0,0 +1,13 @@ +# VoucherTransactionsExportFilterConditionsVoucherId + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**VoucherTransactionsExportFilterConditionsVoucherIdConditions**](VoucherTransactionsExportFilterConditionsVoucherIdConditions.md) | | [optional] + +[[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/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md b/docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md new file mode 100644 index 00000000..1e0a153f --- /dev/null +++ b/docs/VoucherTransactionsExportFilterConditionsVoucherIdConditions.md @@ -0,0 +1,13 @@ +# VoucherTransactionsExportFilterConditionsVoucherIdConditions + +Data filters used to narrow down the data records to be returned in the result. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_in** | **List[str]** | | [optional] + +[[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/VoucherTransactionsExportParameters.md b/docs/VoucherTransactionsExportParameters.md new file mode 100644 index 00000000..fa1899f5 --- /dev/null +++ b/docs/VoucherTransactionsExportParameters.md @@ -0,0 +1,14 @@ +# VoucherTransactionsExportParameters + +List of available fields and filters that can be exported with a gift card or loyalty card transactions export along with the sorting order of the returned data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **List[str]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL` <br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] + +[[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/VoucherTransactionsFilters.md b/docs/VoucherTransactionsFilters.md new file mode 100644 index 00000000..6370539d --- /dev/null +++ b/docs/VoucherTransactionsFilters.md @@ -0,0 +1,15 @@ +# VoucherTransactionsFilters + +List of available fields and filters that can be exported with gift card or loyalty card transactions along with the sorting order of the returned data. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order** | **str** | How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order. | [optional] +**fields** | **List[str]** | Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL` <br> - `CREDITS_ADDITION` <br> - `CREDITS_REFUND` <br> - `CREDITS_REDEMPTION` <br> - `POINTS_ACCRUAL`<br> - `POINTS_REDEMPTION`<br> - `POINTS_REFUND`<br> - `POINTS_ADDITION`<br> - `POINTS_REMOVAL`<br> - `POINTS_EXPIRATION`<br> - `POINTS_TRANSFER_IN`<br> - `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 | | [optional] +**filters** | [**VoucherTransactionsExportFilterConditions**](VoucherTransactionsExportFilterConditions.md) | | + +[[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/VoucherWithCategories.md b/docs/VoucherWithCategories.md new file mode 100644 index 00000000..16fe4929 --- /dev/null +++ b/docs/VoucherWithCategories.md @@ -0,0 +1,40 @@ +# VoucherWithCategories + +This is an object representing a voucher with categories. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**VoucherWithCategoriesGift**](VoucherWithCategoriesGift.md) | | [optional] +**loyalty_card** | [**VoucherWithCategoriesLoyaltyCard**](VoucherWithCategoriesLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**VoucherWithCategoriesPublish**](VoucherWithCategoriesPublish.md) | | [optional] +**redemption** | [**VoucherWithCategoriesRedemption**](VoucherWithCategoriesRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] + +[[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/VoucherWithCategoriesGift.md b/docs/VoucherWithCategoriesGift.md new file mode 100644 index 00000000..31eb9d80 --- /dev/null +++ b/docs/VoucherWithCategoriesGift.md @@ -0,0 +1,15 @@ +# VoucherWithCategoriesGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/VoucherWithCategoriesLoyaltyCard.md b/docs/VoucherWithCategoriesLoyaltyCard.md new file mode 100644 index 00000000..563cd376 --- /dev/null +++ b/docs/VoucherWithCategoriesLoyaltyCard.md @@ -0,0 +1,16 @@ +# VoucherWithCategoriesLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/VoucherWithCategoriesPublish.md b/docs/VoucherWithCategoriesPublish.md new file mode 100644 index 00000000..b4aeebcb --- /dev/null +++ b/docs/VoucherWithCategoriesPublish.md @@ -0,0 +1,15 @@ +# VoucherWithCategoriesPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/VoucherWithCategoriesRedemption.md b/docs/VoucherWithCategoriesRedemption.md new file mode 100644 index 00000000..bd2bf465 --- /dev/null +++ b/docs/VoucherWithCategoriesRedemption.md @@ -0,0 +1,17 @@ +# VoucherWithCategoriesRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/VouchersApi.md b/docs/VouchersApi.md new file mode 100644 index 00000000..968bf3cc --- /dev/null +++ b/docs/VouchersApi.md @@ -0,0 +1,1443 @@ +# voucherify.VouchersApi + +All URIs are relative to *https://api.voucherify.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_voucher**](VouchersApi.md#create_voucher) | **POST** /v1/vouchers/{code} | Create Voucher +[**delete_voucher**](VouchersApi.md#delete_voucher) | **DELETE** /v1/vouchers/{code} | Delete Voucher +[**disable_voucher**](VouchersApi.md#disable_voucher) | **POST** /v1/vouchers/{code}/disable | Disable Voucher +[**enable_voucher**](VouchersApi.md#enable_voucher) | **POST** /v1/vouchers/{code}/enable | Enable Voucher +[**export_voucher_transactions**](VouchersApi.md#export_voucher_transactions) | **POST** /v1/vouchers/{code}/transactions/export | Export Voucher Transactions +[**generate_random_code**](VouchersApi.md#generate_random_code) | **POST** /v1/vouchers | Generate Random Code +[**get_voucher**](VouchersApi.md#get_voucher) | **GET** /v1/vouchers/{code} | Get Voucher +[**import_vouchers**](VouchersApi.md#import_vouchers) | **POST** /v1/vouchers/import | Import Vouchers +[**import_vouchers_using_csv**](VouchersApi.md#import_vouchers_using_csv) | **POST** /v1/vouchers/importCSV | Import Vouchers using CSV +[**list_voucher_transactions**](VouchersApi.md#list_voucher_transactions) | **GET** /v1/vouchers/{code}/transactions | List Voucher Transactions +[**list_vouchers**](VouchersApi.md#list_vouchers) | **GET** /v1/vouchers | List Vouchers +[**release_validation_session**](VouchersApi.md#release_validation_session) | **DELETE** /v1/vouchers/{code}/sessions/{sessionKey} | Release Validation Session +[**update_voucher**](VouchersApi.md#update_voucher) | **PUT** /v1/vouchers/{code} | Update Voucher +[**update_voucher_balance**](VouchersApi.md#update_voucher_balance) | **POST** /v1/vouchers/{code}/balance | Add or Remove Voucher Balance +[**update_vouchers_in_bulk**](VouchersApi.md#update_vouchers_in_bulk) | **POST** /v1/vouchers/bulk/async | Update Vouchers in Bulk +[**update_vouchers_metadata_in_bulk**](VouchersApi.md#update_vouchers_metadata_in_bulk) | **POST** /v1/vouchers/metadata/async | Update Vouchers' Metadata in Bulk + + +# **create_voucher** +> VouchersCreateResponseBody create_voucher(code, vouchers_create_with_specific_code_request_body=vouchers_create_with_specific_code_request_body) + +Create Voucher + +Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_create_response_body import VouchersCreateResponseBody +from voucherify.models.vouchers_create_with_specific_code_request_body import VouchersCreateWithSpecificCodeRequestBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A unique **code** that identifies the voucher. + vouchers_create_with_specific_code_request_body = {"category":"New Customers","type":"DISCOUNT_VOUCHER","discount":{"percent_off":10,"type":"PERCENT","effect":"APPLY_TO_ORDER"},"start_date":"2022-01-01T00:00:00Z","expiration_date":"2022-12-31T23:59:59Z","validity_timeframe":{"duration":"PT1H","interval":"P2D"},"validity_day_of_week":[1,2,3,4,5],"active":false,"additional_info":"This voucher will remain inactive until enabled.","redemption":{"quantity":10},"metadata":{"test":true,"locale":"de-en"},"validation_rules":["val_4j7DCRm2IS59"]} # VouchersCreateWithSpecificCodeRequestBody | Specify the details of the voucher that you would like to create. (optional) + + try: + # Create Voucher + api_response = api_instance.create_voucher(code, vouchers_create_with_specific_code_request_body=vouchers_create_with_specific_code_request_body) + print("The response of VouchersApi->create_voucher:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->create_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A unique **code** that identifies the voucher. | + **vouchers_create_with_specific_code_request_body** | [**VouchersCreateWithSpecificCodeRequestBody**](VouchersCreateWithSpecificCodeRequestBody.md)| Specify the details of the voucher that you would like to create. | [optional] + +### Return type + +[**VouchersCreateResponseBody**](VouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a voucher object if the call succeeded. | - | + +[[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) + +# **delete_voucher** +> delete_voucher(code, force=force) + +Delete Voucher + +Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A unique **code** that identifies the voucher. + force = True # bool | If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. (optional) + + try: + # Delete Voucher + api_instance.delete_voucher(code, force=force) + except Exception as e: + print("Exception when calling VouchersApi->delete_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A unique **code** that identifies the voucher. | + **force** | **bool**| If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if deletion is successful. | - | + +[[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) + +# **disable_voucher** +> VouchersDisableResponseBody disable_voucher(code) + +Disable Voucher + +There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ This method sets the voucher state to **inactive**. The voucher cannot be redeemed. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_disable_response_body import VouchersDisableResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. + + try: + # Disable Voucher + api_response = api_instance.disable_voucher(code) + print("The response of VouchersApi->disable_voucher:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->disable_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | + +### Return type + +[**VouchersDisableResponseBody**](VouchersDisableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a voucher object. | - | + +[[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) + +# **enable_voucher** +> VouchersEnableResponseBody enable_voucher(code) + +Enable Voucher + +There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ The method sets the voucher state to **active**. The voucher can be redeemed - only if the redemption occurs after the start date and the voucher is not expired. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_enable_response_body import VouchersEnableResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. + + try: + # Enable Voucher + api_response = api_instance.enable_voucher(code) + print("The response of VouchersApi->enable_voucher:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->enable_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | + +### Return type + +[**VouchersEnableResponseBody**](VouchersEnableResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a voucher object. | - | + +[[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_voucher_transactions** +> VouchersTransactionsExportCreateResponseBody export_voucher_transactions(code, vouchers_transactions_export_create_request_body=vouchers_transactions_export_create_request_body) + +Export Voucher Transactions + +Export transactions that are associated with credit movements on a gift card or loyalty card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_transactions_export_create_request_body import VouchersTransactionsExportCreateRequestBody +from voucherify.models.vouchers_transactions_export_create_response_body import VouchersTransactionsExportCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'GIFT-CARD-1' # str | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. + vouchers_transactions_export_create_request_body = {"parameters":{"order":"-created_at","fields":["id","type","source_id","reason","balance","amount","created_at","voucher_id","campaign_id","details","source"]}} # VouchersTransactionsExportCreateRequestBody | Specify the parameters for the transaction export. (optional) + + try: + # Export Voucher Transactions + api_response = api_instance.export_voucher_transactions(code, vouchers_transactions_export_create_request_body=vouchers_transactions_export_create_request_body) + print("The response of VouchersApi->export_voucher_transactions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->export_voucher_transactions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | + **vouchers_transactions_export_create_request_body** | [**VouchersTransactionsExportCreateRequestBody**](VouchersTransactionsExportCreateRequestBody.md)| Specify the parameters for the transaction export. | [optional] + +### Return type + +[**VouchersTransactionsExportCreateResponseBody**](VouchersTransactionsExportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns an export object. | - | + +[[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) + +# **generate_random_code** +> VouchersCreateResponseBody generate_random_code(body=body) + +Generate Random Code + +Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_create_response_body import VouchersCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + body = {"category":"New Customers","code":"NEW-WELCOME-COUPON","type":"DISCOUNT_VOUCHER","campaign_id":"camp_Y6dLsYIZloGqP8izufXY6SSJ","discount":{"percent_off":10,"type":"PERCENT","effect":"APPLY_TO_ORDER"},"start_date":"2016-01-01T00:00:00Z","expiration_date":"2022-12-31T23:59:59Z","validity_timeframe":{"duration":"PT1H","interval":"P2D"},"validity_day_of_week":[1,2,3,4,5],"active":false,"additional_info":"This voucher will remain inactive until enabled.","redemption":{"quantity":10},"metadata":{"test":true,"locale":"de-en"},"validation_rules":["val_4j7DCRm2IS59"]} # object | Specify the details of the voucher that you would like to create. (optional) + + try: + # Generate Random Code + api_response = api_instance.generate_random_code(body=body) + print("The response of VouchersApi->generate_random_code:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->generate_random_code: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **object**| Specify the details of the voucher that you would like to create. | [optional] + +### Return type + +[**VouchersCreateResponseBody**](VouchersCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a voucher object if the call succeeded. | - | + +[[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) + +# **get_voucher** +> VouchersGetResponseBody get_voucher(code) + +Get Voucher + +Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_get_response_body import VouchersGetResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A unique **code** that identifies the voucher. + + try: + # Get Voucher + api_response = api_instance.get_voucher(code) + print("The response of VouchersApi->get_voucher:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->get_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A unique **code** that identifies the voucher. | + +### Return type + +[**VouchersGetResponseBody**](VouchersGetResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a voucher object if a valid identifier was provided. Additionally, the response returns validation rules related to the voucher object. They can be inherited from a campaign. | - | + +[[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) + +# **import_vouchers** +> VouchersImportCreateResponseBody import_vouchers(vouchers_import_create_item_request_body) + +Import Vouchers + +Import standalone vouchers and gift cards into the repository. ๐Ÿ“˜ Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_import_create_item_request_body import VouchersImportCreateItemRequestBody +from voucherify.models.vouchers_import_create_response_body import VouchersImportCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + vouchers_import_create_item_request_body = [{"code":"PROMO-CODE30OFF-NO-EFFECT","category":"new customer acquisition","type":"DISCOUNT_VOUCHER","active":true,"discount":{"amount_off":3000,"type":"AMOUNT"},"start_date":"2020-12-01T23:00:00Z","expiration_date":"2023-12-19T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code1"},{"code":"PROMO-CODE30-PERCENT-NO-EFFECT","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"GIFT-CARD-100","type":"GIFT_VOUCHER","active":true,"category":"new customer acquisition","gift":{"amount":10000},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":5},"metadata":{"unit":"EUR"},"additional_info":"secret-GIFT-code2"},{"code":"PROMO-CODE1-PERCENT-EFFECT-ORDER","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT","effect":"APPLY_TO_ORDER"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE2-PERCENT-EFFECT-ITEM","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT","effect":"APPLY_TO_ITEMS"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED","type":"DISCOUNT_VOUCHER","active":false,"discount":{"percent_off":30,"type":"PERCENT"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1,"redeemed_quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY","type":"DISCOUNT_VOUCHER","active":false,"discount":{"amount_off":30,"type":"AMOUNT","effect":"APPLY_TO_ITEMS_PROPORTIONALLY"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-FIXED-EFFECT-ORDER","type":"DISCOUNT_VOUCHER","active":false,"discount":{"fixed_amount":30,"type":"FIXED","effect":"APPLY_TO_ORDER"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING","type":"DISCOUNT_VOUCHER","active":false,"discount":{"unit_off":1,"unit_type":"prod_0a9f9aeddb019a42db","type":"UNIT","effect":"ADD_MISSING_ITEMS"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE2-UNIT-MULTIPLE-ITEMS","type":"DISCOUNT_VOUCHER","active":true,"discount":{"type":"UNIT","effect":"ADD_MANY_ITEMS","units":[{"unit_off":1,"unit_type":"prod_0a9f9aeddb019a42db","effect":"ADD_MISSING_ITEMS"},{"unit_off":1,"unit_type":"prod_0a9f9aeddb019a42db","effect":"ADD_NEW_ITEMS"}]},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"},{"code":"PROMO-CODE1-SHIPPING","type":"DISCOUNT_VOUCHER","active":false,"discount":{"type":"UNIT","unit_off":1,"unit_type":"prod_5h1pp1ng","effect":"ADD_MISSING_ITEMS"},"start_date":"2020-12-10T23:00:00Z","expiration_date":"2023-12-31T23:00:00Z","redemption":{"quantity":1},"metadata":{"unit":"EUR"},"additional_info":"secret-code2"}] # List[VouchersImportCreateItemRequestBody] | The request body is an array of objects. Each object contains details about a specific voucher. + + try: + # Import Vouchers + api_response = api_instance.import_vouchers(vouchers_import_create_item_request_body) + print("The response of VouchersApi->import_vouchers:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->import_vouchers: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **vouchers_import_create_item_request_body** | [**List[VouchersImportCreateItemRequestBody]**](VouchersImportCreateItemRequestBody.md)| The request body is an array of objects. Each object contains details about a specific voucher. | + +### Return type + +[**VouchersImportCreateResponseBody**](VouchersImportCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **import_vouchers_using_csv** +> VouchersImportCsvCreateResponseBody import_vouchers_using_csv(file=file) + +Import Vouchers using CSV + +Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). ___ ๐Ÿ“˜ Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. ๐Ÿ“˜ Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_import_csv_create_response_body import VouchersImportCsvCreateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + file = None # bytearray | File path. (optional) + + try: + # Import Vouchers using CSV + api_response = api_instance.import_vouchers_using_csv(file=file) + print("The response of VouchersApi->import_vouchers_using_csv:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->import_vouchers_using_csv: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file** | **bytearray**| File path. | [optional] + +### Return type + +[**VouchersImportCsvCreateResponseBody**](VouchersImportCsvCreateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the **response** and pass it using the <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **list_voucher_transactions** +> VouchersTransactionsListResponseBody list_voucher_transactions(code, limit=limit, order=order, starting_after_id=starting_after_id) + +List Voucher Transactions + +List transactions that are associated with credit movements on a gift card or loyalty card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_order_list_transactions import ParameterOrderListTransactions +from voucherify.models.vouchers_transactions_list_response_body import VouchersTransactionsListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + order = voucherify.ParameterOrderListTransactions() # ParameterOrderListTransactions | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + starting_after_id = 'starting_after_id_example' # str | A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. (optional) + + try: + # List Voucher Transactions + api_response = api_instance.list_voucher_transactions(code, limit=limit, order=order, starting_after_id=starting_after_id) + print("The response of VouchersApi->list_voucher_transactions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->list_voucher_transactions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **order** | [**ParameterOrderListTransactions**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **starting_after_id** | **str**| A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. | [optional] + +### Return type + +[**VouchersTransactionsListResponseBody**](VouchersTransactionsListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary of transaction objects | - | + +[[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) + +# **list_vouchers** +> VouchersListResponseBody list_vouchers(limit=limit, page=page, category=category, campaign_id=campaign_id, customer=customer, campaign=campaign, created_at=created_at, updated_at=updated_at, order=order, code=code, ids=ids) + +List Vouchers + +Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_order_vouchers import ParameterOrderVouchers +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter +from voucherify.models.vouchers_list_response_body import VouchersListResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + limit = 56 # int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) + page = 56 # int | Which page of results to return. The lowest value is 1. (optional) + category = 'category_example' # str | Limit search results to vouchers within the specified category. (optional) + campaign_id = 'campaign_id_example' # str | Limit search results to vouchers within the specified campaign (optional) + customer = 'customer_example' # str | A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. (optional) + campaign = 'campaign_example' # str | A unique campaign name, identifies the parent campaign. (optional) + created_at = voucherify.ParameterCreatedBeforeAfter() # ParameterCreatedBeforeAfter | A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z (optional) + updated_at = voucherify.ParameterUpdatedBeforeAfter() # ParameterUpdatedBeforeAfter | A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z (optional) + order = voucherify.ParameterOrderVouchers() # ParameterOrderVouchers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) + code = 'code_example' # str | (optional) + ids = ['ids_example'] # List[str] | (optional) + + try: + # List Vouchers + api_response = api_instance.list_vouchers(limit=limit, page=page, category=category, campaign_id=campaign_id, customer=customer, campaign=campaign, created_at=created_at, updated_at=updated_at, order=order, code=code, ids=ids) + print("The response of VouchersApi->list_vouchers:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->list_vouchers: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] + **page** | **int**| Which page of results to return. The lowest value is 1. | [optional] + **category** | **str**| Limit search results to vouchers within the specified category. | [optional] + **campaign_id** | **str**| Limit search results to vouchers within the specified campaign | [optional] + **customer** | **str**| A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. | [optional] + **campaign** | **str**| A unique campaign name, identifies the parent campaign. | [optional] + **created_at** | [**ParameterCreatedBeforeAfter**](.md)| A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z | [optional] + **updated_at** | [**ParameterUpdatedBeforeAfter**](.md)| A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z | [optional] + **order** | [**ParameterOrderVouchers**](.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] + **code** | **str**| | [optional] + **ids** | [**List[str]**](str.md)| | [optional] + +### Return type + +[**VouchersListResponseBody**](VouchersListResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. If no more vouchers are available (query parameter `page` incremented over and above the voucher count), the resulting array will be empty. The result can be narrowed down according to specified (or default) filters. | - | + +[[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) + +# **release_validation_session** +> release_validation_session(code, session_key) + +Release Validation Session + +Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. ๐Ÿ“˜ Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations). + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. + session_key = 'ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts' # str | A unique session identifier. + + try: + # Release Validation Session + api_instance.release_validation_session(code, session_key) + except Exception as e: + print("Exception when calling VouchersApi->release_validation_session: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. | + **session_key** | **str**| A unique session identifier. | + +### Return type + +void (empty response body) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns no content if the validation session was released successfully. | - | + +[[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) + +# **update_voucher** +> VouchersUpdateResponseBody update_voucher(code, vouchers_update_request_body) + +Update Voucher + +Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_update_request_body import VouchersUpdateRequestBody +from voucherify.models.vouchers_update_response_body import VouchersUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A unique **code** that identifies the voucher. + vouchers_update_request_body = {"category":"Second","type":"DISCOUNT_VOUCHER","discount":{"type":"PERCENT","percent_off":45,"percent_off_formula":"IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)","amount_limit":1800,"effect":"APPLY_TO_ORDER"},"start_date":"2020-02-01T00:00:00Z","expiration_date":"2023-12-31T23:59:59Z","validity_timeframe":{"duration":"PT2H","interval":"P3D"},"validity_day_of_week":[0,1,2],"active":false,"additional_info":"This voucher can be used with other coupons. Please feel free to do so.","metadata":{"Season":"Winter"}} # VouchersUpdateRequestBody | Specify the parameters to be updated. + + try: + # Update Voucher + api_response = api_instance.update_voucher(code, vouchers_update_request_body) + print("The response of VouchersApi->update_voucher:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->update_voucher: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A unique **code** that identifies the voucher. | + **vouchers_update_request_body** | [**VouchersUpdateRequestBody**](VouchersUpdateRequestBody.md)| Specify the parameters to be updated. | + +### Return type + +[**VouchersUpdateResponseBody**](VouchersUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the voucher object if the update succeeded. | - | + +[[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) + +# **update_voucher_balance** +> VouchersBalanceUpdateResponseBody update_voucher_balance(code, vouchers_balance_update_request_body) + +Add or Remove Voucher Balance + +Add balance to an existing gift card or loyalty card. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_balance_update_request_body import VouchersBalanceUpdateRequestBody +from voucherify.models.vouchers_balance_update_response_body import VouchersBalanceUpdateResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + code = 'code_example' # str | A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. + vouchers_balance_update_request_body = {"amount":10000} # VouchersBalanceUpdateRequestBody | Provide the amount to be added to/subtracted from the voucher. + + try: + # Add or Remove Voucher Balance + api_response = api_instance.update_voucher_balance(code, vouchers_balance_update_request_body) + print("The response of VouchersApi->update_voucher_balance:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->update_voucher_balance: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **str**| A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. | + **vouchers_balance_update_request_body** | [**VouchersBalanceUpdateRequestBody**](VouchersBalanceUpdateRequestBody.md)| Provide the amount to be added to/subtracted from the voucher. | + +### Return type + +[**VouchersBalanceUpdateResponseBody**](VouchersBalanceUpdateResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns a balance object if the operation succeeded. | - | + +[[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) + +# **update_vouchers_in_bulk** +> VouchersUpdateInBulkResponseBody update_vouchers_in_bulk(vouchers_update_in_bulk_item_request_body) + +Update Vouchers in Bulk + +Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. ๐Ÿšง Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_update_in_bulk_item_request_body import VouchersUpdateInBulkItemRequestBody +from voucherify.models.vouchers_update_in_bulk_response_body import VouchersUpdateInBulkResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + vouchers_update_in_bulk_item_request_body = [{"code":"example_code","metadata":{"lang":"en","test":false,"MetadataTest":"Update metadata","update_value":1,"next_update_date":"2022-11-11T09:00:00.000Z"}},{"code":"example_code2","metadata":{"lang":"pl","test":false,"MetadataTest":"Update metadata","update_value":2}}] # List[VouchersUpdateInBulkItemRequestBody] | List the codes to be updated with the metadata key/value pairs for that code. + + try: + # Update Vouchers in Bulk + api_response = api_instance.update_vouchers_in_bulk(vouchers_update_in_bulk_item_request_body) + print("The response of VouchersApi->update_vouchers_in_bulk:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->update_vouchers_in_bulk: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **vouchers_update_in_bulk_item_request_body** | [**List[VouchersUpdateInBulkItemRequestBody]**](VouchersUpdateInBulkItemRequestBody.md)| List the codes to be updated with the metadata key/value pairs for that code. | + +### Return type + +[**VouchersUpdateInBulkResponseBody**](VouchersUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action. The response informs you that the request has been accepted and the resources will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and use it as a query parameter in the [GET Async Action](ref:get-async-action) endpoint. | - | + +[[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) + +# **update_vouchers_metadata_in_bulk** +> VouchersMetadataUpdateInBulkResponseBody update_vouchers_metadata_in_bulk(vouchers_metadata_update_in_bulk_request_body) + +Update Vouchers' Metadata in Bulk + +Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + +### Example + +* Api Key Authentication (X-App-Id): +* Api Key Authentication (X-App-Token): + +```python +import voucherify +from voucherify.models.vouchers_metadata_update_in_bulk_request_body import VouchersMetadataUpdateInBulkRequestBody +from voucherify.models.vouchers_metadata_update_in_bulk_response_body import VouchersMetadataUpdateInBulkResponseBody +from voucherify.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.voucherify.io +# See configuration.py for a list of all supported configuration parameters. +configuration = voucherify.Configuration( + host = "https://api.voucherify.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: X-App-Id +configuration.api_key['X-App-Id'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Id'] = 'Bearer' + +# Configure API key authorization: X-App-Token +configuration.api_key['X-App-Token'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['X-App-Token'] = 'Bearer' + +# Enter a context with an instance of the API client +with voucherify.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = voucherify.VouchersApi(api_client) + vouchers_metadata_update_in_bulk_request_body = {"codes":["PROMO-CODE810","PROMO-CODE726"],"metadata":{"lang":"en","authorized_internally":true}} # VouchersMetadataUpdateInBulkRequestBody | List the codes of the vouchers you would like to update with the metadata key/value pairs. + + try: + # Update Vouchers' Metadata in Bulk + api_response = api_instance.update_vouchers_metadata_in_bulk(vouchers_metadata_update_in_bulk_request_body) + print("The response of VouchersApi->update_vouchers_metadata_in_bulk:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling VouchersApi->update_vouchers_metadata_in_bulk: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **vouchers_metadata_update_in_bulk_request_body** | [**VouchersMetadataUpdateInBulkRequestBody**](VouchersMetadataUpdateInBulkRequestBody.md)| List the codes of the vouchers you would like to update with the metadata key/value pairs. | + +### Return type + +[**VouchersMetadataUpdateInBulkResponseBody**](VouchersMetadataUpdateInBulkResponseBody.md) + +### Authorization + +[X-App-Id](../README.md#X-App-Id), [X-App-Token](../README.md#X-App-Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**2XX** | Returns the ID of the scheduled asynchronous action. The response informs you that the request has been accepted and the resources will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and use it as a query parameter in the [GET Async Action](ref:get-async-action) endpoint. | - | + +[[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) + diff --git a/docs/VouchersBalanceUpdateRequestBody.md b/docs/VouchersBalanceUpdateRequestBody.md new file mode 100644 index 00000000..dffb34ab --- /dev/null +++ b/docs/VouchersBalanceUpdateRequestBody.md @@ -0,0 +1,15 @@ +# VouchersBalanceUpdateRequestBody + +Request body schema for `vouchers/{code}/balance`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000. | [optional] +**source_id** | **str** | The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. | [optional] +**reason** | **str** | Reason why the transaction occurred. | [optional] + +[[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/VouchersBalanceUpdateResponseBody.md b/docs/VouchersBalanceUpdateResponseBody.md new file mode 100644 index 00000000..a322702f --- /dev/null +++ b/docs/VouchersBalanceUpdateResponseBody.md @@ -0,0 +1,19 @@ +# VouchersBalanceUpdateResponseBody + +Response body schema for `vouchers/{code}/balance.` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | The incremental amount added (positive integer) or subtracted (negative integer) to the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**total** | **int** | Total income incurred over the lifespan of the gift card or loyalty card. | [optional] +**balance** | **int** | The balance after adding or subtracting a specified amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**type** | **str** | The type of voucher being modified. | [optional] +**operation_type** | **str** | | [optional] [default to 'MANUAL'] +**object** | **str** | The type of the object represented by JSON. Default is `balance`. | [optional] [default to 'balance'] +**related_object** | [**VouchersBalanceUpdateResponseBodyRelatedObject**](VouchersBalanceUpdateResponseBodyRelatedObject.md) | | [optional] + +[[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/VouchersBalanceUpdateResponseBodyRelatedObject.md b/docs/VouchersBalanceUpdateResponseBodyRelatedObject.md new file mode 100644 index 00000000..17396c5e --- /dev/null +++ b/docs/VouchersBalanceUpdateResponseBodyRelatedObject.md @@ -0,0 +1,14 @@ +# VouchersBalanceUpdateResponseBodyRelatedObject + +Defines the resource that is being modified with the values that are returned in the balance object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | The object being modified, i.e. `voucher`. | [optional] [default to 'voucher'] +**id** | **str** | Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API. | [optional] + +[[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/VouchersCreateResponseBody.md b/docs/VouchersCreateResponseBody.md new file mode 100644 index 00000000..f8f47abb --- /dev/null +++ b/docs/VouchersCreateResponseBody.md @@ -0,0 +1,41 @@ +# VouchersCreateResponseBody + +Response body schema for **POST** `v1/vouchers` and `/vouchers/{code}` + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**VouchersCreateResponseBodyGift**](VouchersCreateResponseBodyGift.md) | | [optional] +**loyalty_card** | [**VouchersCreateResponseBodyLoyaltyCard**](VouchersCreateResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**VouchersCreateResponseBodyPublish**](VouchersCreateResponseBodyPublish.md) | | [optional] +**redemption** | [**VouchersCreateResponseBodyRedemption**](VouchersCreateResponseBodyRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/VouchersCreateResponseBodyGift.md b/docs/VouchersCreateResponseBodyGift.md new file mode 100644 index 00000000..b3ff4125 --- /dev/null +++ b/docs/VouchersCreateResponseBodyGift.md @@ -0,0 +1,15 @@ +# VouchersCreateResponseBodyGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/VouchersCreateResponseBodyLoyaltyCard.md b/docs/VouchersCreateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..9aa7a127 --- /dev/null +++ b/docs/VouchersCreateResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# VouchersCreateResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/VouchersCreateResponseBodyPublish.md b/docs/VouchersCreateResponseBodyPublish.md new file mode 100644 index 00000000..6fd718ec --- /dev/null +++ b/docs/VouchersCreateResponseBodyPublish.md @@ -0,0 +1,15 @@ +# VouchersCreateResponseBodyPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/VouchersCreateResponseBodyRedemption.md b/docs/VouchersCreateResponseBodyRedemption.md new file mode 100644 index 00000000..ea75b570 --- /dev/null +++ b/docs/VouchersCreateResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# VouchersCreateResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/VouchersCreateWithSpecificCodeRequestBody.md b/docs/VouchersCreateWithSpecificCodeRequestBody.md new file mode 100644 index 00000000..420ac519 --- /dev/null +++ b/docs/VouchersCreateWithSpecificCodeRequestBody.md @@ -0,0 +1,29 @@ +# VouchersCreateWithSpecificCodeRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**campaign** | **str** | Identifies the voucher's parent campaign using a unique campaign name. | [optional] +**campaign_id** | **str** | Identifies the voucher's parent campaign using a unique campaign ID assigned by the Voucherify API. | [optional] +**category** | **str** | The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**category_id** | **str** | Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**start_date** | **datetime** | Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**validation_rules** | **List[str]** | Array containing the ID of the validation rule associated with the voucher. | [optional] +**redemption** | [**VouchersCreateWithSpecificCodeRequestBodyRedemption**](VouchersCreateWithSpecificCodeRequestBodyRedemption.md) | | [optional] +**type** | **str** | | [optional] +**loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/VouchersCreateWithSpecificCodeRequestBodyRedemption.md b/docs/VouchersCreateWithSpecificCodeRequestBodyRedemption.md new file mode 100644 index 00000000..f7f493bc --- /dev/null +++ b/docs/VouchersCreateWithSpecificCodeRequestBodyRedemption.md @@ -0,0 +1,12 @@ +# VouchersCreateWithSpecificCodeRequestBodyRedemption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/VouchersDisableResponseBody.md b/docs/VouchersDisableResponseBody.md new file mode 100644 index 00000000..654892ed --- /dev/null +++ b/docs/VouchersDisableResponseBody.md @@ -0,0 +1,41 @@ +# VouchersDisableResponseBody + +Response body schema for **POST** `v1/vouchers/{code}/disable`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**VouchersDisableResponseBodyGift**](VouchersDisableResponseBodyGift.md) | | [optional] +**loyalty_card** | [**VouchersDisableResponseBodyLoyaltyCard**](VouchersDisableResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**VouchersDisableResponseBodyPublish**](VouchersDisableResponseBodyPublish.md) | | [optional] +**redemption** | [**VouchersDisableResponseBodyRedemption**](VouchersDisableResponseBodyRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/VouchersDisableResponseBodyGift.md b/docs/VouchersDisableResponseBodyGift.md new file mode 100644 index 00000000..7f361670 --- /dev/null +++ b/docs/VouchersDisableResponseBodyGift.md @@ -0,0 +1,15 @@ +# VouchersDisableResponseBodyGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/VouchersDisableResponseBodyLoyaltyCard.md b/docs/VouchersDisableResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..a4f57388 --- /dev/null +++ b/docs/VouchersDisableResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# VouchersDisableResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/VouchersDisableResponseBodyPublish.md b/docs/VouchersDisableResponseBodyPublish.md new file mode 100644 index 00000000..2ac55d06 --- /dev/null +++ b/docs/VouchersDisableResponseBodyPublish.md @@ -0,0 +1,15 @@ +# VouchersDisableResponseBodyPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/VouchersDisableResponseBodyRedemption.md b/docs/VouchersDisableResponseBodyRedemption.md new file mode 100644 index 00000000..b0870a59 --- /dev/null +++ b/docs/VouchersDisableResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# VouchersDisableResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/VouchersEnableResponseBody.md b/docs/VouchersEnableResponseBody.md new file mode 100644 index 00000000..28d0fc22 --- /dev/null +++ b/docs/VouchersEnableResponseBody.md @@ -0,0 +1,41 @@ +# VouchersEnableResponseBody + +Response body schema for **POST** `v1/vouchers/{code}/enable`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**VouchersEnableResponseBodyGift**](VouchersEnableResponseBodyGift.md) | | [optional] +**loyalty_card** | [**VouchersEnableResponseBodyLoyaltyCard**](VouchersEnableResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**VouchersEnableResponseBodyPublish**](VouchersEnableResponseBodyPublish.md) | | [optional] +**redemption** | [**VouchersEnableResponseBodyRedemption**](VouchersEnableResponseBodyRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/VouchersEnableResponseBodyGift.md b/docs/VouchersEnableResponseBodyGift.md new file mode 100644 index 00000000..a58eaf8e --- /dev/null +++ b/docs/VouchersEnableResponseBodyGift.md @@ -0,0 +1,15 @@ +# VouchersEnableResponseBodyGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/VouchersEnableResponseBodyLoyaltyCard.md b/docs/VouchersEnableResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..a31042db --- /dev/null +++ b/docs/VouchersEnableResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# VouchersEnableResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/VouchersEnableResponseBodyPublish.md b/docs/VouchersEnableResponseBodyPublish.md new file mode 100644 index 00000000..a12e0ed1 --- /dev/null +++ b/docs/VouchersEnableResponseBodyPublish.md @@ -0,0 +1,15 @@ +# VouchersEnableResponseBodyPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/VouchersEnableResponseBodyRedemption.md b/docs/VouchersEnableResponseBodyRedemption.md new file mode 100644 index 00000000..c0f7b9a4 --- /dev/null +++ b/docs/VouchersEnableResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# VouchersEnableResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/VouchersGetResponseBody.md b/docs/VouchersGetResponseBody.md new file mode 100644 index 00000000..0f7255aa --- /dev/null +++ b/docs/VouchersGetResponseBody.md @@ -0,0 +1,41 @@ +# VouchersGetResponseBody + +Response body schema for **GET** `v1/vouchers/{code}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**VouchersGetResponseBodyGift**](VouchersGetResponseBodyGift.md) | | [optional] +**loyalty_card** | [**VouchersGetResponseBodyLoyaltyCard**](VouchersGetResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**VouchersGetResponseBodyPublish**](VouchersGetResponseBodyPublish.md) | | [optional] +**redemption** | [**VouchersGetResponseBodyRedemption**](VouchersGetResponseBodyRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/VouchersGetResponseBodyGift.md b/docs/VouchersGetResponseBodyGift.md new file mode 100644 index 00000000..6cada255 --- /dev/null +++ b/docs/VouchersGetResponseBodyGift.md @@ -0,0 +1,15 @@ +# VouchersGetResponseBodyGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/VouchersGetResponseBodyLoyaltyCard.md b/docs/VouchersGetResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..31afeb3d --- /dev/null +++ b/docs/VouchersGetResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# VouchersGetResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/VouchersGetResponseBodyPublish.md b/docs/VouchersGetResponseBodyPublish.md new file mode 100644 index 00000000..a0d56820 --- /dev/null +++ b/docs/VouchersGetResponseBodyPublish.md @@ -0,0 +1,15 @@ +# VouchersGetResponseBodyPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/VouchersGetResponseBodyRedemption.md b/docs/VouchersGetResponseBodyRedemption.md new file mode 100644 index 00000000..84edcded --- /dev/null +++ b/docs/VouchersGetResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# VouchersGetResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/VouchersImportCreateItemRequestBody.md b/docs/VouchersImportCreateItemRequestBody.md new file mode 100644 index 00000000..ba89e771 --- /dev/null +++ b/docs/VouchersImportCreateItemRequestBody.md @@ -0,0 +1,24 @@ +# VouchersImportCreateItemRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Value representing the imported code. | [optional] +**redemption** | [**VouchersImportCreateItemRequestBodyRedemption**](VouchersImportCreateItemRequestBodyRedemption.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**metadata** | **object** | | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**start_date** | **datetime** | Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**expiration_date** | **datetime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**type** | **str** | | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/VouchersImportCreateItemRequestBodyRedemption.md b/docs/VouchersImportCreateItemRequestBodyRedemption.md new file mode 100644 index 00000000..5eb54750 --- /dev/null +++ b/docs/VouchersImportCreateItemRequestBodyRedemption.md @@ -0,0 +1,12 @@ +# VouchersImportCreateItemRequestBodyRedemption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] + +[[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/VouchersImportCreateResponseBody.md b/docs/VouchersImportCreateResponseBody.md new file mode 100644 index 00000000..639e7d38 --- /dev/null +++ b/docs/VouchersImportCreateResponseBody.md @@ -0,0 +1,13 @@ +# VouchersImportCreateResponseBody + +Response body schema for **POST** `v1/vouchers/import`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/VouchersImportCsvCreateResponseBody.md b/docs/VouchersImportCsvCreateResponseBody.md new file mode 100644 index 00000000..11a30125 --- /dev/null +++ b/docs/VouchersImportCsvCreateResponseBody.md @@ -0,0 +1,13 @@ +# VouchersImportCsvCreateResponseBody + +Response body schema for **POST** `v1/vouchers/importCSV`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/VouchersListResponseBody.md b/docs/VouchersListResponseBody.md new file mode 100644 index 00000000..449eab75 --- /dev/null +++ b/docs/VouchersListResponseBody.md @@ -0,0 +1,16 @@ +# VouchersListResponseBody + +Response body schema for **GET** `v1/vouchers`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of voucher objects. | [optional] [default to 'vouchers'] +**vouchers** | [**List[VoucherWithCategories]**](VoucherWithCategories.md) | A dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. | [optional] +**total** | **int** | Returns how many vouchers in the project meet the limits defined by the query parameter definitions. | [optional] + +[[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/VouchersMetadataUpdateInBulkRequestBody.md b/docs/VouchersMetadataUpdateInBulkRequestBody.md new file mode 100644 index 00000000..dea4b1bb --- /dev/null +++ b/docs/VouchersMetadataUpdateInBulkRequestBody.md @@ -0,0 +1,14 @@ +# VouchersMetadataUpdateInBulkRequestBody + +Request body schema for `vouchers/metadata/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**codes** | **List[str]** | An array of voucher codes. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] + +[[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/VouchersMetadataUpdateInBulkResponseBody.md b/docs/VouchersMetadataUpdateInBulkResponseBody.md new file mode 100644 index 00000000..914dc83f --- /dev/null +++ b/docs/VouchersMetadataUpdateInBulkResponseBody.md @@ -0,0 +1,13 @@ +# VouchersMetadataUpdateInBulkResponseBody + +Response body schema for **POST** `v1/vouchers/metadata/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/VouchersRedemptionGetResponseBody.md b/docs/VouchersRedemptionGetResponseBody.md new file mode 100644 index 00000000..14cf7d4a --- /dev/null +++ b/docs/VouchersRedemptionGetResponseBody.md @@ -0,0 +1,19 @@ +# VouchersRedemptionGetResponseBody + +Response body schema for **GET** `v1/vouchers/{code}/redemption`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | The maximum number of times a voucher can be redeemed. | [optional] +**redeemed_quantity** | **int** | The number of times the voucher was redeemed successfully. | [optional] +**object** | **str** | The type of the object represented by JSON. This object stores information about redemptions in a dictionary. | [optional] [default to 'list'] +**url** | **str** | URL | [optional] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of `redemption_entries`. | [optional] [default to 'redemption_entries'] +**total** | **int** | Total number of redemption objects. | [optional] +**redemption_entries** | [**List[RedemptionEntry]**](RedemptionEntry.md) | Contains the array of successful and failed redemption objects. | + +[[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/VouchersTransactionsExportCreateRequestBody.md b/docs/VouchersTransactionsExportCreateRequestBody.md new file mode 100644 index 00000000..7a1a5bb0 --- /dev/null +++ b/docs/VouchersTransactionsExportCreateRequestBody.md @@ -0,0 +1,13 @@ +# VouchersTransactionsExportCreateRequestBody + +Request body schema for **POST** `v1/vouchers/transactions/export`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameters** | [**VoucherTransactionsExportParameters**](VoucherTransactionsExportParameters.md) | | [optional] + +[[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/VouchersTransactionsExportCreateResponseBody.md b/docs/VouchersTransactionsExportCreateResponseBody.md new file mode 100644 index 00000000..29392881 --- /dev/null +++ b/docs/VouchersTransactionsExportCreateResponseBody.md @@ -0,0 +1,21 @@ +# VouchersTransactionsExportCreateResponseBody + +Response body schema for **POST** `v1/vouchers/{code}/transactions/export`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique export ID. | [optional] +**object** | **str** | The type of object being represented. This object stores information about the `export`. | [optional] [default to 'export'] +**created_at** | **datetime** | Timestamp representing the date and time when the export was scheduled in ISO 8601 format. | [optional] +**status** | **str** | Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated. | [optional] [default to 'SCHEDULED'] +**channel** | **str** | The channel through which the export was triggered. | [optional] [default to 'API'] +**exported_object** | **str** | The type of exported object. | [optional] [default to 'voucher_transactions'] +**parameters** | [**VoucherTransactionsFilters**](VoucherTransactionsFilters.md) | | +**result** | [**VouchersTransactionsExportCreateResponseBodyResult**](VouchersTransactionsExportCreateResponseBodyResult.md) | | [optional] +**user_id** | **str** | Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`. | [optional] + +[[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/VouchersTransactionsExportCreateResponseBodyResult.md b/docs/VouchersTransactionsExportCreateResponseBodyResult.md new file mode 100644 index 00000000..b9d33a60 --- /dev/null +++ b/docs/VouchersTransactionsExportCreateResponseBodyResult.md @@ -0,0 +1,13 @@ +# VouchersTransactionsExportCreateResponseBodyResult + +Contains the URL of the CSV file. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **str** | URL of the CSV file location. It contains the `token` used for authorization in the <!-- [Download export](OpenAPI.json/paths/~1exports~1{export_Id}/get) -->[Download export](ref:download-export) method. | [optional] + +[[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/VouchersTransactionsListResponseBody.md b/docs/VouchersTransactionsListResponseBody.md new file mode 100644 index 00000000..60009ce6 --- /dev/null +++ b/docs/VouchersTransactionsListResponseBody.md @@ -0,0 +1,17 @@ +# VouchersTransactionsListResponseBody + +Response body schema for **GET** `v1/vouchers/{code}/transactions`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented by JSON. | [optional] [default to 'list'] +**data_ref** | **str** | Identifies the name of the attribute that contains the array of transaction objects. | [optional] [default to 'data'] +**data** | [**List[VoucherTransaction]**](VoucherTransaction.md) | A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object. | [optional] +**has_more** | **bool** | As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different paging or a different start date filter) to get more records returned in the results. | [optional] +**more_starting_after** | **str** | Returns an ID that can be used to return another page of results. Use the transaction ID in the `starting_after_id` query parameter to display another page of the results starting after the transaction with that ID. | [optional] + +[[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/VouchersUpdateInBulkItemRequestBody.md b/docs/VouchersUpdateInBulkItemRequestBody.md new file mode 100644 index 00000000..a3d57bb8 --- /dev/null +++ b/docs/VouchersUpdateInBulkItemRequestBody.md @@ -0,0 +1,13 @@ +# VouchersUpdateInBulkItemRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Unique voucher code. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] + +[[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/VouchersUpdateInBulkResponseBody.md b/docs/VouchersUpdateInBulkResponseBody.md new file mode 100644 index 00000000..c7f3f97a --- /dev/null +++ b/docs/VouchersUpdateInBulkResponseBody.md @@ -0,0 +1,13 @@ +# VouchersUpdateInBulkResponseBody + +Response body schema for **POST** `v1/vouchers/bulk/async`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**async_action_id** | **str** | The ID of the scheduled asynchronous action. | [optional] + +[[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/VouchersUpdateRequestBody.md b/docs/VouchersUpdateRequestBody.md new file mode 100644 index 00000000..91ebb6bb --- /dev/null +++ b/docs/VouchersUpdateRequestBody.md @@ -0,0 +1,25 @@ +# VouchersUpdateRequestBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**category_id** | **str** | Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint. | [optional] +**start_date** | **datetime** | Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | | [optional] +**type** | **str** | | [optional] +**loyalty_card** | [**SimpleLoyaltyCard**](SimpleLoyaltyCard.md) | | [optional] +**gift** | [**Gift**](Gift.md) | | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] + +[[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/VouchersUpdateResponseBody.md b/docs/VouchersUpdateResponseBody.md new file mode 100644 index 00000000..9522fa45 --- /dev/null +++ b/docs/VouchersUpdateResponseBody.md @@ -0,0 +1,41 @@ +# VouchersUpdateResponseBody + +Response body schema for **PUT** `v1/vouchers/{code}`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Assigned by the Voucherify API, identifies the voucher. | [optional] +**code** | **str** | A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters. | [optional] +**campaign** | **str** | A unique campaign name, identifies the voucher's parent campaign. | [optional] +**campaign_id** | **str** | Assigned by the Voucherify API, identifies the voucher's parent campaign. | [optional] +**category** | **str** | Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint. | [optional] +**category_id** | **str** | Unique category ID assigned by Voucherify. | [optional] +**type** | **str** | Defines the type of the voucher. | [optional] +**discount** | [**Discount**](Discount.md) | | [optional] +**gift** | [**VouchersUpdateResponseBodyGift**](VouchersUpdateResponseBodyGift.md) | | [optional] +**loyalty_card** | [**VouchersUpdateResponseBodyLoyaltyCard**](VouchersUpdateResponseBodyLoyaltyCard.md) | | [optional] +**start_date** | **datetime** | Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. | [optional] +**expiration_date** | **datetime** | Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date. | [optional] +**validity_timeframe** | [**ValidityTimeframe**](ValidityTimeframe.md) | | [optional] +**validity_day_of_week** | **List[int]** | Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday | [optional] +**validity_hours** | [**ValidityHours**](ValidityHours.md) | | [optional] +**active** | **bool** | A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher | [optional] +**additional_info** | **str** | An optional field to keep any extra textual information about the code such as a code description and details. | [optional] +**metadata** | **object** | The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format. | [optional] +**assets** | [**VoucherAssets**](VoucherAssets.md) | | [optional] +**is_referral_code** | **bool** | Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`. | [optional] +**created_at** | **datetime** | Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format. | [optional] +**updated_at** | **datetime** | Timestamp representing the date and time when the voucher was last updated in ISO 8601 format. | [optional] +**holder_id** | **str** | Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify. | [optional] +**referrer_id** | **str** | Unique identifier of the referring person. | [optional] +**object** | **str** | The type of the object represented by JSON. Default is `voucher`. | [optional] [default to 'voucher'] +**publish** | [**VouchersUpdateResponseBodyPublish**](VouchersUpdateResponseBodyPublish.md) | | [optional] +**redemption** | [**VouchersUpdateResponseBodyRedemption**](VouchersUpdateResponseBodyRedemption.md) | | [optional] +**categories** | [**List[Category]**](Category.md) | Contains details about the category. | [optional] +**validation_rules_assignments** | [**ValidationRulesAssignmentsList**](ValidationRulesAssignmentsList.md) | | [optional] + +[[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/VouchersUpdateResponseBodyGift.md b/docs/VouchersUpdateResponseBodyGift.md new file mode 100644 index 00000000..efa29c94 --- /dev/null +++ b/docs/VouchersUpdateResponseBodyGift.md @@ -0,0 +1,15 @@ +# VouchersUpdateResponseBodyGift + +Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**balance** | **int** | Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. | [optional] +**effect** | **str** | Defines how the credits are applied to the customer's order. | [optional] + +[[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/VouchersUpdateResponseBodyLoyaltyCard.md b/docs/VouchersUpdateResponseBodyLoyaltyCard.md new file mode 100644 index 00000000..5e83c5e3 --- /dev/null +++ b/docs/VouchersUpdateResponseBodyLoyaltyCard.md @@ -0,0 +1,16 @@ +# VouchersUpdateResponseBodyLoyaltyCard + +Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **int** | Total points incurred over the lifespan of the loyalty card. | [optional] +**balance** | **int** | Points available for reward redemption. | [optional] +**next_expiration_date** | **date** | The next closest date when the next set of points are due to expire. | [optional] +**next_expiration_points** | **int** | The amount of points that are set to expire next. | [optional] + +[[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/VouchersUpdateResponseBodyPublish.md b/docs/VouchersUpdateResponseBodyPublish.md new file mode 100644 index 00000000..25e40173 --- /dev/null +++ b/docs/VouchersUpdateResponseBodyPublish.md @@ -0,0 +1,15 @@ +# VouchersUpdateResponseBodyPublish + +Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute. | [optional] [default to 'list'] +**count** | **int** | Publication events counter. | [optional] +**url** | **str** | The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications` | [optional] + +[[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/VouchersUpdateResponseBodyRedemption.md b/docs/VouchersUpdateResponseBodyRedemption.md new file mode 100644 index 00000000..3543082d --- /dev/null +++ b/docs/VouchersUpdateResponseBodyRedemption.md @@ -0,0 +1,17 @@ +# VouchersUpdateResponseBodyRedemption + +Stores a summary of redemptions that have been applied to the voucher. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quantity** | **int** | How many times a voucher can be redeemed. A `null` value means unlimited. | [optional] +**redeemed_quantity** | **int** | How many times a voucher has already been redeemed. | [optional] +**redeemed_points** | **int** | Total loyalty points redeemed. | [optional] +**object** | **str** | The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute. | [optional] [default to 'list'] +**url** | **str** | The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions` | [optional] + +[[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/examples/customer_test.py b/examples/customer_test.py deleted file mode 100644 index 6d5fa4b7..00000000 --- a/examples/customer_test.py +++ /dev/null @@ -1,62 +0,0 @@ -import pprint -from example_utils import getArgs, waitForInput - -from voucherify import Client as voucherifyClient - -args = getArgs() - -""" -Initialization -""" -voucherify = voucherifyClient( - application_id="c70a6f00-cf91-4756-9df5-47628850002b", - client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c" -) - -""" -Create Customer -""" -payload = { - "name": "John Doe", - "email": "john@email.com", - "description": "Sample description of customer", - "metadata": { - "lang": "en" - } -} - -result = voucherify.customers.create(payload) -pprint.pprint("--- Create ---") -pprint.pprint(result) - - -waitForInput(args.wait) - - -""" -Get Customer -""" -result = voucherify.customers.get(result.get("id")) -pprint.pprint("--- Get customer ---") -pprint.pprint(result) - -waitForInput(args.wait) - -""" -Update Customer -""" -payload = result -payload['description'] = "Sample description of customer with changes" - -result = voucherify.customers.update(payload) -pprint.pprint("--- Update ---") -pprint.pprint(result) - -waitForInput(args.wait) - -""" -Delete Customer -""" -result = voucherify.customers.delete(result["id"]) -result = pprint.pprint("--- Delete ---") -pprint.pprint(result) diff --git a/examples/example_utils.py b/examples/example_utils.py deleted file mode 100644 index 150ce58b..00000000 --- a/examples/example_utils.py +++ /dev/null @@ -1,16 +0,0 @@ -import argparse - - -def getArgs(): - parser = argparse.ArgumentParser() - parser.add_argument("--wait", action="store_true", help="if set, the program will wait after every example") - return parser.parse_args() - - -def waitForInput(wait=False): - if not wait: - return - try: - input('Press Enter to continue...') - except SyntaxError: - pass diff --git a/examples/voucherify_test.py b/examples/voucherify_test.py deleted file mode 100644 index 0922b3bc..00000000 --- a/examples/voucherify_test.py +++ /dev/null @@ -1,196 +0,0 @@ -import pprint -from example_utils import getArgs, waitForInput - -from voucherify import Client as voucherifyClient -from voucherify import utils - -args = getArgs() - -""" -Initialization -""" -voucherify = voucherifyClient( - application_id="c70a6f00-cf91-4756-9df5-47628850002b", - client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c" -) - -tracking_id = "PythonTestUser" -voucher = { - "code": "PythonVoucherTest", - "discount": { - "type": "AMOUNT", - "amount_off": 12436 - }, - "category": "PythonTestCategory", - "start_date": "2016-01-01T00:00:00Z", - "expiration_date": None, - "redemption": { - "quantity": None, - "redeemed_quantity": 0 - }, - "active": True -} - -""" -Create voucher -""" -pprint.pprint("=== Create voucher ===") -new_voucher = voucherify.vouchers.create(voucher) -pprint.pprint(new_voucher) - -waitForInput(args.wait) - -""" -Get voucher -""" -pprint.pprint("=== Get voucher ===") -voucher = voucherify.vouchers.get(voucher["code"]) -pprint.pprint(voucher) - -waitForInput(args.wait) - -""" -List vouchers from category -""" -pprint.pprint("=== List vouchers from category ===") -filter_params = { - "limit": 10, - "skip": 20, - "category": "PythonTestCategory" -} -vouchers_list = voucherify.vouchers.list(filter_params) -pprint.pprint(vouchers_list) - -waitForInput(args.wait) - -""" -Disable Voucher -""" -pprint.pprint("=== Disable Voucher ===") -result = voucherify.vouchers.disable(voucher["code"]) -pprint.pprint(result) - -waitForInput(args.wait) - -pprint.pprint("=== Disable not existing Voucher ===") -result = voucherify.vouchers.disable("TotallyRandomVoucher") -pprint.pprint(result) - -waitForInput(args.wait) - -""" -Enable Voucher -""" -pprint.pprint("=== Enable Voucher ===") -result = voucherify.vouchers.enable(voucher["code"]) -pprint.pprint(result) - -waitForInput(args.wait) - -pprint.pprint("=== Disable not existing Voucher ===") -result = voucherify.vouchers.enable("TotallyRandomVoucher") -pprint.pprint(result) - -waitForInput(args.wait) - -""" -Redeem Voucher -""" -pprint.pprint("=== Redeem Voucher ===") -result = voucherify.redemptions.redeem(voucher["code"]) -redemption_id = result['id'] -pprint.pprint(result) - -waitForInput(args.wait) - -pprint.pprint("=== Redeem Voucher with Tracking ID ===") -result = voucherify.redemptions.redeem(voucher["code"], tracking_id) -pprint.pprint(result) - -waitForInput(args.wait) - -pprint.pprint("=== Redeem Voucher with Customer Info ===") -customer = { - "source_id": "alice.morgan", - "name": "Alice Morgan", - "email": "alice@morgan.com", - "description": "", - "metadata": { - "locale": "en-GB", - "shoeSize": 5, - "favourite_brands": ["Armani", "L'Autre Chose", "Vicini"] - } -} -payload = { - "voucher": voucher['code'], - "customer": customer -} -result = voucherify.redemptions.redeem(payload) -pprint.pprint(result) - -waitForInput(args.wait) - -""" -Redemption Voucher -""" -pprint.pprint("=== Redemption Voucher ===") -redemptions_voucher_list = voucherify.redemptions.getForVoucher(voucher["code"]) -pprint.pprint(redemptions_voucher_list) - -waitForInput(args.wait) - -""" -Redemptions List -""" -pprint.pprint("=== Redemptions Voucher ===") -filter_params = { - "limit": 1, - "page": 0, - "[created_at][before]": "2016-12-31T23:59:59Z", - "[created_at][after]": "2015-01-01T00:00:00Z", - "result": "SUCCESS" -} -redemptions_list = voucherify.redemptions.list(filter_params) -pprint.pprint(redemptions_list) - -waitForInput(args.wait) - -""" -Rollback Voucher -""" -pprint.pprint("=== Rollback Redemption ===") -rollback_reason = "Wrong Customer" -result = voucherify.redemptions.rollback(redemption_id, rollback_reason) -pprint.pprint(result) - -waitForInput(args.wait) - -""" -Publish Voucher -""" -pprint.pprint("=== Publish Voucher with customer details and channel ===") -payload = { - "channel": "Email", - "customer": "donny.roll@mail.com" -} -result = voucherify.distributions.publish(payload) -pprint.pprint(result) - -waitForInput(args.wait) - -""" -Utils -""" -pprint.pprint("=== Calculate Discount Amount and Price after discount===") - -unit_price = 83.45 -items_count = 13 -base_price = unit_price * items_count - -discount = utils.calculate_discount(base_price, voucher, unit_price) -new_price = utils.calculate_price(base_price, voucher, unit_price) -pprint.pprint(unit_price) -pprint.pprint(items_count) -pprint.pprint(base_price) -pprint.pprint(new_price) -pprint.pprint(discount) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..3a646c34 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,71 @@ +[tool.poetry] +name = "voucherify" +version = "3.0.0" +description = "Voucherify API" +authors = ["Voucherify Team "] +license = "MIT" +readme = "README.md" +repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" +keywords = ["OpenAPI", "OpenAPI-Generator", "Voucherify API"] +include = ["voucherify/py.typed"] + +[tool.poetry.dependencies] +python = "^3.7" + +urllib3 = ">= 1.25.3" +python-dateutil = ">=2.8.2" +pydantic = ">=2" +typing-extensions = ">=4.7.1" + +[tool.poetry.dev-dependencies] +pytest = ">=7.2.1" +tox = ">=3.9.0" +flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "voucherify", + #"test", # auto-generated tests + "tests", # hand-written tests +] +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +strict_concatenate = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true diff --git a/requirements.txt b/requirements.txt index 2033de8c..cc85509e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,5 @@ -requests>=1.0.0 -six>=1.0.0 \ No newline at end of file +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.25.3, < 2.1.0 +pydantic >= 2 +typing-extensions >= 4.7.1 diff --git a/running_code_example.py b/running_code_example.py new file mode 100644 index 00000000..c3b7d12a --- /dev/null +++ b/running_code_example.py @@ -0,0 +1,38 @@ +import os +import voucherify +from dotenv import load_dotenv + +load_dotenv() + +HOST = os.getenv('VOUCHERIFY_HOST', 'https://api.voucherify.io') +X_APP_ID = os.getenv('X_APP_ID') +X_APP_TOKEN = os.getenv('X_APP_TOKEN') + +if not X_APP_ID or not X_APP_TOKEN: + raise ValueError("X_APP_ID and X_APP_TOKEN must be set in the .env file.") + +configuration = voucherify.Configuration( + host=HOST, + api_key={ + "X-App-Id": X_APP_ID, + "X-App-Token": X_APP_TOKEN + } +) +# Debugging line +api_key_id = configuration.get_api_key_with_prefix('X-App-Id') +api_key_token = configuration.get_api_key_with_prefix('X-App-Token') + +# Print whether both API keys are present and valid +are_keys_present = bool(api_key_id) and bool(api_key_token) +print(f"Configuration loaded: {are_keys_present}") + +if(are_keys_present): + with voucherify.ApiClient(configuration) as api_client: + customers_api_instance = voucherify.CustomersApi(api_client) + + try: + result = customers_api_instance.list_customers() + print(result) + + except voucherifyClient.ApiException as e: + self.fail(e) \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..11433ee8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/setup.py b/setup.py index 5afbb449..b63b35a2 100755 --- a/setup.py +++ b/setup.py @@ -1,47 +1,51 @@ -import sys -import os -from setuptools import setup +# coding: utf-8 -sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'voucherify')) +""" + Voucherify API -__version__ = '2.2.2' -__pypi_username__ = 'voucherify' -__pypi_packagename__ = 'voucherify' -__github_username__ = 'voucherifyio' -__github_reponame__ = 'voucherify-python-sdk' + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. -long_description = ''' - The Voucherify REST SDK provides Python APIs to create, process and manage vouchers. - 1. https://github.com/voucherifyio/voucherify-python-sdk/ - README and Samples - 2. https://voucherify.readme.io/ - API Reference - ''' + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "voucherify" +VERSION = "3.0.0" +PYTHON_REQUIRES = ">=3.7" +REQUIRES = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil", + "pydantic >= 2", + "typing-extensions >= 4.7.1", +] setup( - name=__pypi_packagename__, - version=__version__, - author='Voucherify', - author_email='it@voucherify.io', - packages=['voucherify'], - scripts=[], - url='https://github.com/' + __github_username__ + '/' + __github_reponame__, - license='MIT', - description='The Voucherify REST SDK provides Python APIs to create, process and manage vouchers.', - long_description=long_description, - classifiers=[ - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries :: Python Modules' - ], - install_requires=['requests>=1.0.0', 'six>=1.0.0'], - keywords=['voucherify', 'rest', 'sdk'] + name=NAME, + version=VERSION, + description="Voucherify API", + author="Voucherify Team", + author_email="support@voucherify.io", + url="https://voucherify.io/", + keywords=["OpenAPI", "OpenAPI-Generator", "Voucherify API"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + license="MIT", + long_description_content_type='text/markdown', + long_description="""\ + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + """, # noqa: E501 + package_data={"voucherify": ["py.typed"]}, ) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..0784548c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,7 @@ +pytest~=7.1.3 +pytest-cov>=2.8.1 +pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 +python-dotenv >= 1.0.0 +responses >= 0.24.0, < 1.0.0 diff --git a/tests/test_customers_e2e.py b/tests/test_customers_e2e.py deleted file mode 100644 index d80562c5..00000000 --- a/tests/test_customers_e2e.py +++ /dev/null @@ -1,40 +0,0 @@ -from voucherify import Client as voucherifyClient - -""" -Initialization -""" -voucherify = voucherifyClient( - application_id="c70a6f00-cf91-4756-9df5-47628850002b", - client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c" -) - - -def test_customerCRUD(): - payload = { - "name": "John Doe", - "email": "john@email.com", - "description": "Sample description of customer", - "metadata": { - "lang": "en" - } - } - - result = voucherify.customers.create(payload) -# create - assert result.get('description') == payload.get('description') - assert result.get('email') == payload.get('email') -# retrieve - customer = voucherify.customers.get(result.get('id')) - assert customer.get('description') == result.get('description') - assert customer.get('email') == result.get('email') -# update - updatePayload = { - "id": customer.get('id'), - "description": 'changed description for customer' - } - updatedCustomer = voucherify.customers.update(updatePayload) - assert updatedCustomer.get('description') == updatePayload.get('description') -# delete - voucherify.customers.delete(updatedCustomer.get('id')) - result = voucherify.customers.get(updatedCustomer.get('id')) - assert result.get('code') == 404 diff --git a/tests/test_distributions_e2e.py b/tests/test_distributions_e2e.py deleted file mode 100644 index d21d6ebd..00000000 --- a/tests/test_distributions_e2e.py +++ /dev/null @@ -1,18 +0,0 @@ -from voucherify import Client as voucherifyClient - -voucherify = voucherifyClient( - application_id="c70a6f00-cf91-4756-9df5-47628850002b", - client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c" -) - -def test_publishVoucher(): - params = { - "channel": "Email", - "customer": { - "source_id": "donny.roll@mail.com" - }, - "campaign": "Predefined Gift Cards" - } - result = voucherify.distributions.publish(params) - assert result.get('voucher').get('active') is True - assert result.get('voucher').get('type') == 'GIFT_VOUCHER' diff --git a/tests/test_redemptions_e2e.py b/tests/test_redemptions_e2e.py deleted file mode 100644 index 17ab0339..00000000 --- a/tests/test_redemptions_e2e.py +++ /dev/null @@ -1,87 +0,0 @@ -from voucherify import Client as voucherifyClient -import time - -voucherify = voucherifyClient( - application_id="c70a6f00-cf91-4756-9df5-47628850002b", - client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c" -) - -tracking_id = 'PythonTestUser' -testVoucher = { - "code": "PythonVoucherTest", - "discount": { - "type": "AMOUNT", - "amount_off": 12436 - }, - "category": "PythonTestCategory", - "start_date": "2016-01-01T00:00:00Z", - "expiration_date": None, - "redemption": { - "quantity": None, - "redeemed_quantity": 0 - }, - "active": True -} - - -def test_redeemVoucher(voucherifyInstance=voucherify.redemptions): - result = voucherifyInstance.redeem(testVoucher.get('code')) - assert result.get('result') == 'SUCCESS' - assert result.get('voucher', {}).get('code') == testVoucher.get('code') - - -def test_redeemVoucherWithTrackingId(voucherifyInstance=voucherify.redemptions): - result = voucherifyInstance.redeem(testVoucher.get('code'), tracking_id) - assert result.get('result') == 'SUCCESS' - assert result.get('voucher', {}).get('code') == testVoucher.get('code') - assert len(result.get('tracking_id')) > 0 - - -def test_redeemVoucherWithCustomerInfo(voucherifyInstance=voucherify.redemptions): - customer = { - "source_id": "alice.morgan", - "name": "Alice Morgan", - "email": "alice@morgan.com", - "description": "", - "metadata": { - "locale": "en-GB", - "shoeSize": 5, - "favourite_brands": "Armani" - } - } - payload = { - "voucher": testVoucher.get('code'), - "customer": customer - } - result = voucherifyInstance.redeem(payload) - assert result.get('result') == 'SUCCESS' - assert result.get('voucher', {}).get('code') == testVoucher.get('code') - - -def test_getVoucherRedemption(testedMethod=voucherify.redemptions.getForVoucher): - result = testedMethod(testVoucher.get('code')) - assert result.get('data_ref') == 'redemption_entries' - assert isinstance(result.get('redemption_entries'), list) - - -def test_listVoucherRedemptions(testedMethod=voucherify.redemptions.list): - filter_params = { - "limit": 1, - "page": 1, - "[created_at][before]": "2016-12-31T23:59:59Z", - "[created_at][after]": "2015-01-01T00:00:00Z", - "result": "SUCCESS" - } - redemptionsList = testedMethod(filter_params) - assert redemptionsList.get('data_ref') == 'redemptions' - assert isinstance(redemptionsList.get('redemptions'), list) - -def test_voucherRedemptionRollback(voucherifyInstance=voucherify.redemptions): - redemption = voucherifyInstance.redeem(testVoucher.get('code')) - redemptionId = redemption.get('id') - reason = 'just testing' - - time.sleep(1) - rollbackResult = voucherifyInstance.rollback(redemptionId, reason) - assert rollbackResult.get('result') == 'SUCCESS' - assert rollbackResult.get('reason') == reason diff --git a/tests/test_utils.py b/tests/test_utils.py deleted file mode 100644 index 4c1e1a49..00000000 --- a/tests/test_utils.py +++ /dev/null @@ -1,48 +0,0 @@ -from voucherify import utils - -unit_price = 83.45 -items_count = 13 -base_price = unit_price * items_count - -def test_shouldCalculateAmountPriceDiscount(): - voucher = { - "code": "PythonVoucherTest", - "discount": { - "type": "AMOUNT", - "amount_off": 12436 - }, - "category": "PythonTestCategory", - "start_date": "2016-01-01T00:00:00Z", - "expiration_date": None, - "redemption": { - "quantity": None, - "redeemed_quantity": 0 - }, - "active": True - } - discount = utils.calculate_discount(base_price, voucher, unit_price) - price = utils.calculate_price(base_price, voucher, unit_price) - assert discount == 124.36 - assert price == 960.49 - -def test_shouldCalculateAmountDiscountWhenGiftIsNone(): - voucher = { - "code": "PythonVoucherTest", - "discount": { - "type": "AMOUNT", - "amount_off": 12436 - }, - "gift": None, - "category": "PythonTestCategory", - "start_date": "2016-01-01T00:00:00Z", - "expiration_date": None, - "redemption": { - "quantity": None, - "redeemed_quantity": 0 - }, - "active": True - } - discount = utils.calculate_discount(base_price, voucher, unit_price) - price = utils.calculate_price(base_price, voucher, unit_price) - assert discount == 124.36 - assert price == 960.49 diff --git a/tests/test_vouchers_e2e.py b/tests/test_vouchers_e2e.py deleted file mode 100644 index 00de20c9..00000000 --- a/tests/test_vouchers_e2e.py +++ /dev/null @@ -1,79 +0,0 @@ -import datetime -from voucherify import Client as voucherifyClient - -voucherify = voucherifyClient( - application_id="c70a6f00-cf91-4756-9df5-47628850002b", - client_secret_key="3266b9f8-e246-4f79-bdf0-833929b1380c" -) - -testVoucher = { - "code": "PythonVoucherTest", - "discount": { - "type": "AMOUNT", - "amount_off": 12436 - }, - "category": "PythonTestCategory", - "start_date": "2016-01-01T00:00:00Z", - "expiration_date": None, - "redemption": { - "quantity": None, - "redeemed_quantity": 0 - }, - "active": True -} - - -def test_createExistingVoucher(voucherifyInstance=voucherify.vouchers): - result = voucherifyInstance.create(testVoucher) - assert result.get('code') > 400 - - -def test_updateVoucher(voucherifyInstance=voucherify.vouchers): - uniquePerRun = str(datetime.datetime.utcnow()) - testVoucher['additional_info'] = uniquePerRun - result = voucherifyInstance.update(testVoucher) - assert result.get('additional_info') == uniquePerRun - - -def test_getVoucher(voucherifyInstance=voucherify.vouchers): - voucher = voucherifyInstance.get(testVoucher.get('code')) - assert voucher.get('code') == testVoucher.get('code') - - -def test_listVouchersFromCategory(voucherifyInstance=voucherify.vouchers): - filter_params = { - "limit": 1, - "category": "PythonTestCategory" - } - vouchers = voucherifyInstance.list(filter_params) - assert len(vouchers.get('vouchers')) == 1 - voucher = vouchers.get('vouchers')[0] - assert voucher.get('code') == testVoucher.get('code') - - -def test_disableEnableActiveVoucher(voucherifyInstance=voucherify.vouchers): - voucher = voucherifyInstance.get(testVoucher.get('code')) - assert voucher.get('active') is True - disable_result = voucherifyInstance.disable(testVoucher.get('code')) - assert voucherifyInstance.get(testVoucher.get('code')).get('active') is False - assert disable_result.get('active') is False - - enable_result = voucherifyInstance.enable(testVoucher.get('code')) - assert voucherifyInstance.get(testVoucher.get('code')).get('active') is True - assert enable_result.get('active') is True - - -def test_disableEnableVoucherThatDoesntExist(voucherifyInstance=voucherify.vouchers): - randomVoucherCode = 'oaewhiuraowutehaowuet' - - def testEnable(): - result = voucherifyInstance.enable(randomVoucherCode) - # assert result is VoucherifyError - assert result.get('code') == 404 - - def testDisable(): - result = voucherifyInstance.enable(randomVoucherCode) - # assert result is VoucherifyError - assert result.get('code') == 404 - testEnable() - testDisable() diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..7bfad51e --- /dev/null +++ b/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=voucherify diff --git a/voucherify/__init__.py b/voucherify/__init__.py index b4f556f7..fa40c63e 100644 --- a/voucherify/__init__.py +++ b/voucherify/__init__.py @@ -1,2 +1,980 @@ -from voucherify.client import Client -import voucherify.utils as utils +# coding: utf-8 + +# flake8: noqa + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "3.0.0" + +# import apis into sdk package +from voucherify.api.async_actions_api import AsyncActionsApi +from voucherify.api.campaigns_api import CampaignsApi +from voucherify.api.categories_api import CategoriesApi +from voucherify.api.client_side_api import ClientSideApi +from voucherify.api.customers_api import CustomersApi +from voucherify.api.events_api import EventsApi +from voucherify.api.exports_api import ExportsApi +from voucherify.api.loyalties_api import LoyaltiesApi +from voucherify.api.orders_api import OrdersApi +from voucherify.api.product_collections_api import ProductCollectionsApi +from voucherify.api.products_api import ProductsApi +from voucherify.api.promotions_api import PromotionsApi +from voucherify.api.publications_api import PublicationsApi +from voucherify.api.qualifications_api import QualificationsApi +from voucherify.api.redemptions_api import RedemptionsApi +from voucherify.api.rewards_api import RewardsApi +from voucherify.api.segments_api import SegmentsApi +from voucherify.api.validation_rules_api import ValidationRulesApi +from voucherify.api.validations_api import ValidationsApi +from voucherify.api.vouchers_api import VouchersApi + +# import ApiClient +from voucherify.api_response import ApiResponse +from voucherify.api_client import ApiClient +from voucherify.configuration import Configuration +from voucherify.exceptions import OpenApiException +from voucherify.exceptions import ApiTypeError +from voucherify.exceptions import ApiValueError +from voucherify.exceptions import ApiKeyError +from voucherify.exceptions import ApiAttributeError +from voucherify.exceptions import ApiException + +# import models into sdk package +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.applicable_to import ApplicableTo +from voucherify.models.applicable_to_effect import ApplicableToEffect +from voucherify.models.applicable_to_result_list import ApplicableToResultList +from voucherify.models.area_store_campaign_assignment import AreaStoreCampaignAssignment +from voucherify.models.async_action_base import AsyncActionBase +from voucherify.models.async_action_get_response_body import AsyncActionGetResponseBody +from voucherify.models.async_actions_list_response_body import AsyncActionsListResponseBody +from voucherify.models.bus_val_rule_assignment import BusValRuleAssignment +from voucherify.models.campaign_base import CampaignBase +from voucherify.models.campaign_loyalty_card import CampaignLoyaltyCard +from voucherify.models.campaign_loyalty_card_expiration_rules import CampaignLoyaltyCardExpirationRules +from voucherify.models.campaign_loyalty_voucher import CampaignLoyaltyVoucher +from voucherify.models.campaign_loyalty_voucher_redemption import CampaignLoyaltyVoucherRedemption +from voucherify.models.campaign_voucher import CampaignVoucher +from voucherify.models.campaign_voucher_redemption import CampaignVoucherRedemption +from voucherify.models.campaigns_create_request_body import CampaignsCreateRequestBody +from voucherify.models.campaigns_create_request_body_promotion import CampaignsCreateRequestBodyPromotion +from voucherify.models.campaigns_create_request_body_voucher import CampaignsCreateRequestBodyVoucher +from voucherify.models.campaigns_create_request_body_voucher_redemption import CampaignsCreateRequestBodyVoucherRedemption +from voucherify.models.campaigns_create_response_body import CampaignsCreateResponseBody +from voucherify.models.campaigns_delete_response_body import CampaignsDeleteResponseBody +from voucherify.models.campaigns_get_response_body import CampaignsGetResponseBody +from voucherify.models.campaigns_import_create_response_body import CampaignsImportCreateResponseBody +from voucherify.models.campaigns_import_csv_create_response_body import CampaignsImportCsvCreateResponseBody +from voucherify.models.campaigns_import_voucher_item import CampaignsImportVoucherItem +from voucherify.models.campaigns_import_voucher_item_redemption import CampaignsImportVoucherItemRedemption +from voucherify.models.campaigns_list_response_body import CampaignsListResponseBody +from voucherify.models.campaigns_update_request_body import CampaignsUpdateRequestBody +from voucherify.models.campaigns_update_request_body_options import CampaignsUpdateRequestBodyOptions +from voucherify.models.campaigns_update_response_body import CampaignsUpdateResponseBody +from voucherify.models.campaigns_vouchers_create_combined_response_body import CampaignsVouchersCreateCombinedResponseBody +from voucherify.models.campaigns_vouchers_create_combined_response_body_gift import CampaignsVouchersCreateCombinedResponseBodyGift +from voucherify.models.campaigns_vouchers_create_combined_response_body_loyalty_card import CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard +from voucherify.models.campaigns_vouchers_create_combined_response_body_publish import CampaignsVouchersCreateCombinedResponseBodyPublish +from voucherify.models.campaigns_vouchers_create_combined_response_body_redemption import CampaignsVouchersCreateCombinedResponseBodyRedemption +from voucherify.models.campaigns_vouchers_create_in_bulk_request_body import CampaignsVouchersCreateInBulkRequestBody +from voucherify.models.campaigns_vouchers_create_in_bulk_request_body_redemption import CampaignsVouchersCreateInBulkRequestBodyRedemption +from voucherify.models.campaigns_vouchers_create_request_body import CampaignsVouchersCreateRequestBody +from voucherify.models.campaigns_vouchers_create_request_body_redemption import CampaignsVouchersCreateRequestBodyRedemption +from voucherify.models.campaigns_vouchers_create_response_body import CampaignsVouchersCreateResponseBody +from voucherify.models.campaigns_vouchers_create_response_body_gift import CampaignsVouchersCreateResponseBodyGift +from voucherify.models.campaigns_vouchers_create_response_body_loyalty_card import CampaignsVouchersCreateResponseBodyLoyaltyCard +from voucherify.models.campaigns_vouchers_create_response_body_publish import CampaignsVouchersCreateResponseBodyPublish +from voucherify.models.campaigns_vouchers_create_response_body_redemption import CampaignsVouchersCreateResponseBodyRedemption +from voucherify.models.categories_create_request_body import CategoriesCreateRequestBody +from voucherify.models.categories_create_response_body import CategoriesCreateResponseBody +from voucherify.models.categories_get_response_body import CategoriesGetResponseBody +from voucherify.models.categories_list_response_body import CategoriesListResponseBody +from voucherify.models.categories_update_request_body import CategoriesUpdateRequestBody +from voucherify.models.categories_update_response_body import CategoriesUpdateResponseBody +from voucherify.models.category import Category +from voucherify.models.client_events_create_request_body import ClientEventsCreateRequestBody +from voucherify.models.client_events_create_request_body_loyalty import ClientEventsCreateRequestBodyLoyalty +from voucherify.models.client_events_create_request_body_referral import ClientEventsCreateRequestBodyReferral +from voucherify.models.client_events_create_response_body import ClientEventsCreateResponseBody +from voucherify.models.client_promotions_tiers_list_response_body import ClientPromotionsTiersListResponseBody +from voucherify.models.client_qualifications_check_eligibility_request_body import ClientQualificationsCheckEligibilityRequestBody +from voucherify.models.client_qualifications_check_eligibility_response_body import ClientQualificationsCheckEligibilityResponseBody +from voucherify.models.client_redemptions_redeem_request_body import ClientRedemptionsRedeemRequestBody +from voucherify.models.client_redemptions_redeem_request_body_options import ClientRedemptionsRedeemRequestBodyOptions +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item import ClientRedemptionsRedeemRequestBodyRedeemablesItem +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item_gift import ClientRedemptionsRedeemRequestBodyRedeemablesItemGift +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item_reward import ClientRedemptionsRedeemRequestBodyRedeemablesItemReward +from voucherify.models.client_redemptions_redeem_response_body import ClientRedemptionsRedeemResponseBody +from voucherify.models.client_validations_validate_request_body import ClientValidationsValidateRequestBody +from voucherify.models.client_validations_validate_request_body_options import ClientValidationsValidateRequestBodyOptions +from voucherify.models.client_validations_validate_request_body_redeemables_item import ClientValidationsValidateRequestBodyRedeemablesItem +from voucherify.models.client_validations_validate_request_body_redeemables_item_gift import ClientValidationsValidateRequestBodyRedeemablesItemGift +from voucherify.models.client_validations_validate_request_body_redeemables_item_reward import ClientValidationsValidateRequestBodyRedeemablesItemReward +from voucherify.models.client_validations_validate_response_body import ClientValidationsValidateResponseBody +from voucherify.models.client_validations_validate_response_body_redeemables_item import ClientValidationsValidateResponseBodyRedeemablesItem +from voucherify.models.client_validations_validate_response_body_redeemables_item_result import ClientValidationsValidateResponseBodyRedeemablesItemResult +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_details import ClientValidationsValidateResponseBodyRedeemablesItemResultDetails +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_discount import ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_discount_product import ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_gift import ClientValidationsValidateResponseBodyRedeemablesItemResultGift +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_loyalty_card import ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard +from voucherify.models.code_config import CodeConfig +from voucherify.models.create_publication_campaign import CreatePublicationCampaign +from voucherify.models.customer import Customer +from voucherify.models.customer_activity import CustomerActivity +from voucherify.models.customer_address import CustomerAddress +from voucherify.models.customer_id import CustomerId +from voucherify.models.customer_loyalty import CustomerLoyalty +from voucherify.models.customer_redeemable import CustomerRedeemable +from voucherify.models.customer_redeemable_redeemable import CustomerRedeemableRedeemable +from voucherify.models.customer_referrals import CustomerReferrals +from voucherify.models.customer_referrals_campaigns_item import CustomerReferralsCampaignsItem +from voucherify.models.customer_summary import CustomerSummary +from voucherify.models.customer_summary_orders import CustomerSummaryOrders +from voucherify.models.customer_summary_redemptions import CustomerSummaryRedemptions +from voucherify.models.customer_summary_redemptions_gift import CustomerSummaryRedemptionsGift +from voucherify.models.customer_summary_redemptions_loyalty_card import CustomerSummaryRedemptionsLoyaltyCard +from voucherify.models.customer_with_summary_loyalty_referrals import CustomerWithSummaryLoyaltyReferrals +from voucherify.models.customer_with_summary_loyalty_referrals_address import CustomerWithSummaryLoyaltyReferralsAddress +from voucherify.models.customer_with_summary_loyalty_referrals_assets import CustomerWithSummaryLoyaltyReferralsAssets +from voucherify.models.customers_activity_list_response_body import CustomersActivityListResponseBody +from voucherify.models.customers_create_request_body import CustomersCreateRequestBody +from voucherify.models.customers_create_request_body_address import CustomersCreateRequestBodyAddress +from voucherify.models.customers_create_response_body import CustomersCreateResponseBody +from voucherify.models.customers_create_response_body_address import CustomersCreateResponseBodyAddress +from voucherify.models.customers_create_response_body_assets import CustomersCreateResponseBodyAssets +from voucherify.models.customers_get_response_body import CustomersGetResponseBody +from voucherify.models.customers_get_response_body_address import CustomersGetResponseBodyAddress +from voucherify.models.customers_get_response_body_assets import CustomersGetResponseBodyAssets +from voucherify.models.customers_import_csv_create_response_body import CustomersImportCsvCreateResponseBody +from voucherify.models.customers_list_response_body import CustomersListResponseBody +from voucherify.models.customers_metadata_update_in_bulk_request_body import CustomersMetadataUpdateInBulkRequestBody +from voucherify.models.customers_metadata_update_in_bulk_response_body import CustomersMetadataUpdateInBulkResponseBody +from voucherify.models.customers_permanent_deletion_create_response_body import CustomersPermanentDeletionCreateResponseBody +from voucherify.models.customers_permanent_deletion_create_response_body_data_json import CustomersPermanentDeletionCreateResponseBodyDataJson +from voucherify.models.customers_redeemables_list_response_body import CustomersRedeemablesListResponseBody +from voucherify.models.customers_segments_list_response_body import CustomersSegmentsListResponseBody +from voucherify.models.customers_update_in_bulk_request_body import CustomersUpdateInBulkRequestBody +from voucherify.models.customers_update_in_bulk_request_body_address import CustomersUpdateInBulkRequestBodyAddress +from voucherify.models.customers_update_in_bulk_response_body import CustomersUpdateInBulkResponseBody +from voucherify.models.customers_update_request_body import CustomersUpdateRequestBody +from voucherify.models.customers_update_request_body_address import CustomersUpdateRequestBodyAddress +from voucherify.models.customers_update_response_body import CustomersUpdateResponseBody +from voucherify.models.customers_update_response_body_address import CustomersUpdateResponseBodyAddress +from voucherify.models.customers_update_response_body_assets import CustomersUpdateResponseBodyAssets +from voucherify.models.discount import Discount +from voucherify.models.discount_unit_multiple_one_unit import DiscountUnitMultipleOneUnit +from voucherify.models.earning_rule import EarningRule +from voucherify.models.earning_rule_custom_event import EarningRuleCustomEvent +from voucherify.models.earning_rule_loyalty import EarningRuleLoyalty +from voucherify.models.earning_rule_loyalty_custom_event import EarningRuleLoyaltyCustomEvent +from voucherify.models.earning_rule_loyalty_custom_event_metadata import EarningRuleLoyaltyCustomEventMetadata +from voucherify.models.earning_rule_loyalty_customer import EarningRuleLoyaltyCustomer +from voucherify.models.earning_rule_loyalty_customer_metadata import EarningRuleLoyaltyCustomerMetadata +from voucherify.models.earning_rule_loyalty_order import EarningRuleLoyaltyOrder +from voucherify.models.earning_rule_loyalty_order_amount import EarningRuleLoyaltyOrderAmount +from voucherify.models.earning_rule_loyalty_order_items import EarningRuleLoyaltyOrderItems +from voucherify.models.earning_rule_loyalty_order_items_amount import EarningRuleLoyaltyOrderItemsAmount +from voucherify.models.earning_rule_loyalty_order_items_quantity import EarningRuleLoyaltyOrderItemsQuantity +from voucherify.models.earning_rule_loyalty_order_items_subtotal_amount import EarningRuleLoyaltyOrderItemsSubtotalAmount +from voucherify.models.earning_rule_loyalty_order_metadata import EarningRuleLoyaltyOrderMetadata +from voucherify.models.earning_rule_loyalty_order_total_amount import EarningRuleLoyaltyOrderTotalAmount +from voucherify.models.earning_rule_loyalty_tier import EarningRuleLoyaltyTier +from voucherify.models.earning_rule_segment import EarningRuleSegment +from voucherify.models.earning_rule_source import EarningRuleSource +from voucherify.models.error import Error +from voucherify.models.events_create_request_body import EventsCreateRequestBody +from voucherify.models.events_create_request_body_loyalty import EventsCreateRequestBodyLoyalty +from voucherify.models.events_create_request_body_referral import EventsCreateRequestBodyReferral +from voucherify.models.events_create_response_body import EventsCreateResponseBody +from voucherify.models.export import Export +from voucherify.models.export_order_fields import ExportOrderFields +from voucherify.models.export_order_order import ExportOrderOrder +from voucherify.models.export_parameters import ExportParameters +from voucherify.models.export_parameters_filters import ExportParametersFilters +from voucherify.models.export_result import ExportResult +from voucherify.models.export_voucher_transactions_fields import ExportVoucherTransactionsFields +from voucherify.models.export_voucher_transactions_filters import ExportVoucherTransactionsFilters +from voucherify.models.export_voucher_transactions_order import ExportVoucherTransactionsOrder +from voucherify.models.exports_create_request_body import ExportsCreateRequestBody +from voucherify.models.exports_create_request_body_parameters import ExportsCreateRequestBodyParameters +from voucherify.models.exports_create_request_body_parameters_filters import ExportsCreateRequestBodyParametersFilters +from voucherify.models.exports_create_response_body import ExportsCreateResponseBody +from voucherify.models.exports_create_response_body_parameters import ExportsCreateResponseBodyParameters +from voucherify.models.exports_create_response_body_parameters_filters import ExportsCreateResponseBodyParametersFilters +from voucherify.models.exports_get_response_body import ExportsGetResponseBody +from voucherify.models.exports_get_response_body_parameters import ExportsGetResponseBodyParameters +from voucherify.models.exports_get_response_body_parameters_filters import ExportsGetResponseBodyParametersFilters +from voucherify.models.exports_get_response_body_result import ExportsGetResponseBodyResult +from voucherify.models.exports_list_response_body import ExportsListResponseBody +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.filters_condition import FiltersCondition +from voucherify.models.gift import Gift +from voucherify.models.inapplicable_to import InapplicableTo +from voucherify.models.inapplicable_to_result_list import InapplicableToResultList +from voucherify.models.junction import Junction +from voucherify.models.list_publications_item_voucher import ListPublicationsItemVoucher +from voucherify.models.loyalties_create_campaign_request_body import LoyaltiesCreateCampaignRequestBody +from voucherify.models.loyalties_create_campaign_response_body import LoyaltiesCreateCampaignResponseBody +from voucherify.models.loyalties_delete_response_body import LoyaltiesDeleteResponseBody +from voucherify.models.loyalties_earning_rules_create_request_body_item import LoyaltiesEarningRulesCreateRequestBodyItem +from voucherify.models.loyalties_earning_rules_create_request_body_item_custom_event import LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty import LoyaltiesEarningRulesCreateRequestBodyItemLoyalty +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_custom_event import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_customer import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_tier import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier +from voucherify.models.loyalties_earning_rules_create_request_body_item_segment import LoyaltiesEarningRulesCreateRequestBodyItemSegment +from voucherify.models.loyalties_earning_rules_create_request_body_item_source import LoyaltiesEarningRulesCreateRequestBodyItemSource +from voucherify.models.loyalties_earning_rules_create_response_body import LoyaltiesEarningRulesCreateResponseBody +from voucherify.models.loyalties_earning_rules_create_response_body_custom_event import LoyaltiesEarningRulesCreateResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty import LoyaltiesEarningRulesCreateResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_custom_event import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_customer import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_tier import LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_create_response_body_segment import LoyaltiesEarningRulesCreateResponseBodySegment +from voucherify.models.loyalties_earning_rules_create_response_body_source import LoyaltiesEarningRulesCreateResponseBodySource +from voucherify.models.loyalties_earning_rules_disable_response_body import LoyaltiesEarningRulesDisableResponseBody +from voucherify.models.loyalties_earning_rules_disable_response_body_custom_event import LoyaltiesEarningRulesDisableResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty import LoyaltiesEarningRulesDisableResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_custom_event import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_customer import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_tier import LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_disable_response_body_segment import LoyaltiesEarningRulesDisableResponseBodySegment +from voucherify.models.loyalties_earning_rules_disable_response_body_source import LoyaltiesEarningRulesDisableResponseBodySource +from voucherify.models.loyalties_earning_rules_enable_response_body import LoyaltiesEarningRulesEnableResponseBody +from voucherify.models.loyalties_earning_rules_enable_response_body_custom_event import LoyaltiesEarningRulesEnableResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty import LoyaltiesEarningRulesEnableResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_custom_event import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_customer import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_tier import LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_enable_response_body_segment import LoyaltiesEarningRulesEnableResponseBodySegment +from voucherify.models.loyalties_earning_rules_enable_response_body_source import LoyaltiesEarningRulesEnableResponseBodySource +from voucherify.models.loyalties_earning_rules_get_response_body import LoyaltiesEarningRulesGetResponseBody +from voucherify.models.loyalties_earning_rules_get_response_body_custom_event import LoyaltiesEarningRulesGetResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty import LoyaltiesEarningRulesGetResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_custom_event import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_customer import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_tier import LoyaltiesEarningRulesGetResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_get_response_body_segment import LoyaltiesEarningRulesGetResponseBodySegment +from voucherify.models.loyalties_earning_rules_get_response_body_source import LoyaltiesEarningRulesGetResponseBodySource +from voucherify.models.loyalties_earning_rules_list_response_body import LoyaltiesEarningRulesListResponseBody +from voucherify.models.loyalties_earning_rules_update_request_body import LoyaltiesEarningRulesUpdateRequestBody +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty import LoyaltiesEarningRulesUpdateRequestBodyLoyalty +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_custom_event import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_customer import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_customer_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_quantity import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_total_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_update_request_body_source import LoyaltiesEarningRulesUpdateRequestBodySource +from voucherify.models.loyalties_earning_rules_update_response_body import LoyaltiesEarningRulesUpdateResponseBody +from voucherify.models.loyalties_earning_rules_update_response_body_custom_event import LoyaltiesEarningRulesUpdateResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty import LoyaltiesEarningRulesUpdateResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_custom_event import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_customer import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_tier import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_update_response_body_segment import LoyaltiesEarningRulesUpdateResponseBodySegment +from voucherify.models.loyalties_earning_rules_update_response_body_source import LoyaltiesEarningRulesUpdateResponseBodySource +from voucherify.models.loyalties_get_campaign_response_body import LoyaltiesGetCampaignResponseBody +from voucherify.models.loyalties_list_campaigns_response_body import LoyaltiesListCampaignsResponseBody +from voucherify.models.loyalties_list_members_response_body import LoyaltiesListMembersResponseBody +from voucherify.models.loyalties_loyalty_tier_reward import LoyaltiesLoyaltyTierReward +from voucherify.models.loyalties_member_activity_list_response_body import LoyaltiesMemberActivityListResponseBody +from voucherify.models.loyalties_members_balance_update_request_body import LoyaltiesMembersBalanceUpdateRequestBody +from voucherify.models.loyalties_members_balance_update_response_body import LoyaltiesMembersBalanceUpdateResponseBody +from voucherify.models.loyalties_members_balance_update_response_body_related_object import LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject +from voucherify.models.loyalties_members_create_request_body import LoyaltiesMembersCreateRequestBody +from voucherify.models.loyalties_members_create_response_body import LoyaltiesMembersCreateResponseBody +from voucherify.models.loyalties_members_create_response_body_loyalty_card import LoyaltiesMembersCreateResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_create_response_body_publish import LoyaltiesMembersCreateResponseBodyPublish +from voucherify.models.loyalties_members_create_response_body_redemption import LoyaltiesMembersCreateResponseBodyRedemption +from voucherify.models.loyalties_members_get_response_body import LoyaltiesMembersGetResponseBody +from voucherify.models.loyalties_members_get_response_body_loyalty_card import LoyaltiesMembersGetResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_get_response_body_publish import LoyaltiesMembersGetResponseBodyPublish +from voucherify.models.loyalties_members_get_response_body_redemption import LoyaltiesMembersGetResponseBodyRedemption +from voucherify.models.loyalties_members_points_expiration_list_response_body import LoyaltiesMembersPointsExpirationListResponseBody +from voucherify.models.loyalties_members_points_expiration_list_response_body_data_item import LoyaltiesMembersPointsExpirationListResponseBodyDataItem +from voucherify.models.loyalties_members_points_expiration_list_response_body_data_item_bucket import LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket +from voucherify.models.loyalties_members_redemption_redeem_request_body import LoyaltiesMembersRedemptionRedeemRequestBody +from voucherify.models.loyalties_members_redemption_redeem_request_body_reward import LoyaltiesMembersRedemptionRedeemRequestBodyReward +from voucherify.models.loyalties_members_redemption_redeem_response_body import LoyaltiesMembersRedemptionRedeemResponseBody +from voucherify.models.loyalties_members_redemption_redeem_response_body_channel import LoyaltiesMembersRedemptionRedeemResponseBodyChannel +from voucherify.models.loyalties_members_redemption_redeem_response_body_gift import LoyaltiesMembersRedemptionRedeemResponseBodyGift +from voucherify.models.loyalties_members_redemption_redeem_response_body_loyalty_card import LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher import LoyaltiesMembersRedemptionRedeemResponseBodyVoucher +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_gift import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_loyalty_card import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_publish import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_redemption import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption +from voucherify.models.loyalties_members_rewards_list_response_body import LoyaltiesMembersRewardsListResponseBody +from voucherify.models.loyalties_members_rewards_list_response_body_data_item import LoyaltiesMembersRewardsListResponseBodyDataItem +from voucherify.models.loyalties_members_tiers_list_response_body import LoyaltiesMembersTiersListResponseBody +from voucherify.models.loyalties_members_transactions_export_create_request_body import LoyaltiesMembersTransactionsExportCreateRequestBody +from voucherify.models.loyalties_members_transactions_export_create_request_body_parameters import LoyaltiesMembersTransactionsExportCreateRequestBodyParameters +from voucherify.models.loyalties_members_transactions_export_create_response_body import LoyaltiesMembersTransactionsExportCreateResponseBody +from voucherify.models.loyalties_members_transactions_export_create_response_body_parameters import LoyaltiesMembersTransactionsExportCreateResponseBodyParameters +from voucherify.models.loyalties_members_transactions_list_response_body import LoyaltiesMembersTransactionsListResponseBody +from voucherify.models.loyalties_members_transfers_create_response_body import LoyaltiesMembersTransfersCreateResponseBody +from voucherify.models.loyalties_members_transfers_create_response_body_assets import LoyaltiesMembersTransfersCreateResponseBodyAssets +from voucherify.models.loyalties_members_transfers_create_response_body_assets_barcode import LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode +from voucherify.models.loyalties_members_transfers_create_response_body_assets_qr import LoyaltiesMembersTransfersCreateResponseBodyAssetsQr +from voucherify.models.loyalties_members_transfers_create_response_body_loyalty_card import LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_transfers_create_response_body_publish import LoyaltiesMembersTransfersCreateResponseBodyPublish +from voucherify.models.loyalties_members_transfers_create_response_body_redemption import LoyaltiesMembersTransfersCreateResponseBodyRedemption +from voucherify.models.loyalties_points_expiration_export_create_request_body import LoyaltiesPointsExpirationExportCreateRequestBody +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters import LoyaltiesPointsExpirationExportCreateRequestBodyParameters +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions +from voucherify.models.loyalties_points_expiration_export_create_response_body import LoyaltiesPointsExpirationExportCreateResponseBody +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters import LoyaltiesPointsExpirationExportCreateResponseBodyParameters +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions +from voucherify.models.loyalties_reward_assignments_get_response_body import LoyaltiesRewardAssignmentsGetResponseBody +from voucherify.models.loyalties_reward_assignments_get_response_body_parameters import LoyaltiesRewardAssignmentsGetResponseBodyParameters +from voucherify.models.loyalties_reward_assignments_get_response_body_parameters_loyalty import LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty +from voucherify.models.loyalties_reward_assignments_list_response_body import LoyaltiesRewardAssignmentsListResponseBody +from voucherify.models.loyalties_reward_assignments_reward_get_response_body import LoyaltiesRewardAssignmentsRewardGetResponseBody +from voucherify.models.loyalties_reward_assignments_reward_get_response_body_attributes import LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes +from voucherify.models.loyalties_rewards_create_assignment_item_request_body import LoyaltiesRewardsCreateAssignmentItemRequestBody +from voucherify.models.loyalties_rewards_create_assignment_item_request_body_parameters import LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters +from voucherify.models.loyalties_rewards_create_assignment_item_request_body_parameters_loyalty import LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty +from voucherify.models.loyalties_rewards_create_assignment_response_body import LoyaltiesRewardsCreateAssignmentResponseBody +from voucherify.models.loyalties_rewards_create_assignment_response_body_parameters import LoyaltiesRewardsCreateAssignmentResponseBodyParameters +from voucherify.models.loyalties_rewards_create_assignment_response_body_parameters_loyalty import LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty +from voucherify.models.loyalties_rewards_get_response_body import LoyaltiesRewardsGetResponseBody +from voucherify.models.loyalties_rewards_get_response_body_parameters import LoyaltiesRewardsGetResponseBodyParameters +from voucherify.models.loyalties_rewards_get_response_body_parameters_loyalty import LoyaltiesRewardsGetResponseBodyParametersLoyalty +from voucherify.models.loyalties_rewards_list_assignments_response_body import LoyaltiesRewardsListAssignmentsResponseBody +from voucherify.models.loyalties_rewards_update_assignment_request_body import LoyaltiesRewardsUpdateAssignmentRequestBody +from voucherify.models.loyalties_rewards_update_assignment_request_body_parameters import LoyaltiesRewardsUpdateAssignmentRequestBodyParameters +from voucherify.models.loyalties_rewards_update_assignment_request_body_parameters_loyalty import LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty +from voucherify.models.loyalties_rewards_update_assignment_response_body import LoyaltiesRewardsUpdateAssignmentResponseBody +from voucherify.models.loyalties_rewards_update_assignment_response_body_parameters import LoyaltiesRewardsUpdateAssignmentResponseBodyParameters +from voucherify.models.loyalties_rewards_update_assignment_response_body_parameters_loyalty import LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty +from voucherify.models.loyalties_tiers_create_in_bulk_request_body_item import LoyaltiesTiersCreateInBulkRequestBodyItem +from voucherify.models.loyalties_tiers_earning_rules_list_response_body import LoyaltiesTiersEarningRulesListResponseBody +from voucherify.models.loyalties_tiers_get_response_body import LoyaltiesTiersGetResponseBody +from voucherify.models.loyalties_tiers_get_response_body_config import LoyaltiesTiersGetResponseBodyConfig +from voucherify.models.loyalties_tiers_get_response_body_config_points import LoyaltiesTiersGetResponseBodyConfigPoints +from voucherify.models.loyalties_tiers_get_response_body_points import LoyaltiesTiersGetResponseBodyPoints +from voucherify.models.loyalties_tiers_list_response_body import LoyaltiesTiersListResponseBody +from voucherify.models.loyalties_tiers_rewards_list_response_body import LoyaltiesTiersRewardsListResponseBody +from voucherify.models.loyalties_transfer_points import LoyaltiesTransferPoints +from voucherify.models.loyalties_update_campaign_request_body import LoyaltiesUpdateCampaignRequestBody +from voucherify.models.loyalties_update_campaign_request_body_options import LoyaltiesUpdateCampaignRequestBodyOptions +from voucherify.models.loyalties_update_campaign_response_body import LoyaltiesUpdateCampaignResponseBody +from voucherify.models.loyalty_campaign import LoyaltyCampaign +from voucherify.models.loyalty_campaign_voucher import LoyaltyCampaignVoucher +from voucherify.models.loyalty_campaign_voucher_redemption import LoyaltyCampaignVoucherRedemption +from voucherify.models.loyalty_card_transaction import LoyaltyCardTransaction +from voucherify.models.loyalty_card_transaction_details import LoyaltyCardTransactionDetails +from voucherify.models.loyalty_card_transaction_details_balance import LoyaltyCardTransactionDetailsBalance +from voucherify.models.loyalty_card_transaction_details_balance_related_object import LoyaltyCardTransactionDetailsBalanceRelatedObject +from voucherify.models.loyalty_card_transaction_details_custom_event import LoyaltyCardTransactionDetailsCustomEvent +from voucherify.models.loyalty_card_transaction_details_earning_rule import LoyaltyCardTransactionDetailsEarningRule +from voucherify.models.loyalty_card_transaction_details_earning_rule_source import LoyaltyCardTransactionDetailsEarningRuleSource +from voucherify.models.loyalty_card_transaction_details_event import LoyaltyCardTransactionDetailsEvent +from voucherify.models.loyalty_card_transaction_details_event_schema import LoyaltyCardTransactionDetailsEventSchema +from voucherify.models.loyalty_card_transaction_details_loyalty_tier import LoyaltyCardTransactionDetailsLoyaltyTier +from voucherify.models.loyalty_card_transaction_details_order import LoyaltyCardTransactionDetailsOrder +from voucherify.models.loyalty_card_transaction_details_redemption import LoyaltyCardTransactionDetailsRedemption +from voucherify.models.loyalty_card_transaction_details_reward import LoyaltyCardTransactionDetailsReward +from voucherify.models.loyalty_card_transaction_details_rollback import LoyaltyCardTransactionDetailsRollback +from voucherify.models.loyalty_card_transaction_details_segment import LoyaltyCardTransactionDetailsSegment +from voucherify.models.loyalty_card_transactions_type import LoyaltyCardTransactionsType +from voucherify.models.loyalty_member import LoyaltyMember +from voucherify.models.loyalty_member_loyalty_card import LoyaltyMemberLoyaltyCard +from voucherify.models.loyalty_member_publish import LoyaltyMemberPublish +from voucherify.models.loyalty_member_redemption import LoyaltyMemberRedemption +from voucherify.models.loyalty_tier import LoyaltyTier +from voucherify.models.loyalty_tier_base import LoyaltyTierBase +from voucherify.models.loyalty_tier_base_points import LoyaltyTierBasePoints +from voucherify.models.loyalty_tier_config import LoyaltyTierConfig +from voucherify.models.loyalty_tier_config_points import LoyaltyTierConfigPoints +from voucherify.models.loyalty_tier_expiration import LoyaltyTierExpiration +from voucherify.models.loyalty_tier_points import LoyaltyTierPoints +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.loyalty_tiers_expiration_all_expiration_date import LoyaltyTiersExpirationAllExpirationDate +from voucherify.models.loyalty_tiers_expiration_all_expiration_date_rounding import LoyaltyTiersExpirationAllExpirationDateRounding +from voucherify.models.loyalty_tiers_expiration_all_start_date import LoyaltyTiersExpirationAllStartDate +from voucherify.models.lucky_draw import LuckyDraw +from voucherify.models.member_activity import MemberActivity +from voucherify.models.order import Order +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.order_calculated_item_product import OrderCalculatedItemProduct +from voucherify.models.order_calculated_item_sku import OrderCalculatedItemSku +from voucherify.models.order_item import OrderItem +from voucherify.models.order_item_product import OrderItemProduct +from voucherify.models.order_item_sku import OrderItemSku +from voucherify.models.orders_create_request_body import OrdersCreateRequestBody +from voucherify.models.orders_create_response_body import OrdersCreateResponseBody +from voucherify.models.orders_export_create_request_body import OrdersExportCreateRequestBody +from voucherify.models.orders_export_create_request_body_parameters import OrdersExportCreateRequestBodyParameters +from voucherify.models.orders_export_create_response_body import OrdersExportCreateResponseBody +from voucherify.models.orders_export_create_response_body_parameters import OrdersExportCreateResponseBodyParameters +from voucherify.models.orders_get_response_body import OrdersGetResponseBody +from voucherify.models.orders_import_create_request_body_item import OrdersImportCreateRequestBodyItem +from voucherify.models.orders_import_create_response_body import OrdersImportCreateResponseBody +from voucherify.models.orders_list_response_body import OrdersListResponseBody +from voucherify.models.orders_update_request_body import OrdersUpdateRequestBody +from voucherify.models.orders_update_response_body import OrdersUpdateResponseBody +from voucherify.models.parameter_activity_category import ParameterActivityCategory +from voucherify.models.parameter_campaign_type import ParameterCampaignType +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_expand_list_campaigns import ParameterExpandListCampaigns +from voucherify.models.parameter_filters_list_customer_redeemables import ParameterFiltersListCustomerRedeemables +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_id import ParameterFiltersListCustomerRedeemablesCampaignId +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_type import ParameterFiltersListCustomerRedeemablesCampaignType +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_type_conditions import ParameterFiltersListCustomerRedeemablesCampaignTypeConditions +from voucherify.models.parameter_filters_list_customer_redeemables_created_at import ParameterFiltersListCustomerRedeemablesCreatedAt +from voucherify.models.parameter_filters_list_customer_redeemables_created_at_conditions import ParameterFiltersListCustomerRedeemablesCreatedAtConditions +from voucherify.models.parameter_filters_list_customer_redeemables_holder_role import ParameterFiltersListCustomerRedeemablesHolderRole +from voucherify.models.parameter_filters_list_customer_redeemables_holder_role_conditions import ParameterFiltersListCustomerRedeemablesHolderRoleConditions +from voucherify.models.parameter_filters_list_customer_redeemables_id import ParameterFiltersListCustomerRedeemablesId +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_id import ParameterFiltersListCustomerRedeemablesRedeemableId +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_object import ParameterFiltersListCustomerRedeemablesRedeemableObject +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_object_conditions import ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions +from voucherify.models.parameter_filters_list_customer_redeemables_voucher_type import ParameterFiltersListCustomerRedeemablesVoucherType +from voucherify.models.parameter_filters_list_customer_redeemables_voucher_type_conditions import ParameterFiltersListCustomerRedeemablesVoucherTypeConditions +from voucherify.models.parameter_filters_list_redemptions import ParameterFiltersListRedemptions +from voucherify.models.parameter_filters_list_redemptions_campaign_name import ParameterFiltersListRedemptionsCampaignName +from voucherify.models.parameter_filters_list_redemptions_customer_id import ParameterFiltersListRedemptionsCustomerId +from voucherify.models.parameter_filters_list_redemptions_failure_code import ParameterFiltersListRedemptionsFailureCode +from voucherify.models.parameter_filters_list_redemptions_object import ParameterFiltersListRedemptionsObject +from voucherify.models.parameter_filters_list_redemptions_parent_redemption_id import ParameterFiltersListRedemptionsParentRedemptionId +from voucherify.models.parameter_filters_list_redemptions_related_object_id import ParameterFiltersListRedemptionsRelatedObjectId +from voucherify.models.parameter_filters_list_redemptions_related_object_parent_id import ParameterFiltersListRedemptionsRelatedObjectParentId +from voucherify.models.parameter_filters_list_redemptions_result import ParameterFiltersListRedemptionsResult +from voucherify.models.parameter_filters_list_redemptions_user_login import ParameterFiltersListRedemptionsUserLogin +from voucherify.models.parameter_filters_list_redemptions_voucher_code import ParameterFiltersListRedemptionsVoucherCode +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.parameter_order_created_at import ParameterOrderCreatedAt +from voucherify.models.parameter_order_list_all_promotion_stacks import ParameterOrderListAllPromotionStacks +from voucherify.models.parameter_order_list_campaigns import ParameterOrderListCampaigns +from voucherify.models.parameter_order_list_customers import ParameterOrderListCustomers +from voucherify.models.parameter_order_list_earning_rules import ParameterOrderListEarningRules +from voucherify.models.parameter_order_list_exports import ParameterOrderListExports +from voucherify.models.parameter_order_list_loyalty_tiers import ParameterOrderListLoyaltyTiers +from voucherify.models.parameter_order_list_orders import ParameterOrderListOrders +from voucherify.models.parameter_order_list_promotion_tiers import ParameterOrderListPromotionTiers +from voucherify.models.parameter_order_list_promotion_tiers_client_side import ParameterOrderListPromotionTiersClientSide +from voucherify.models.parameter_order_list_publications import ParameterOrderListPublications +from voucherify.models.parameter_order_list_redeemables import ParameterOrderListRedeemables +from voucherify.models.parameter_order_list_redemptions import ParameterOrderListRedemptions +from voucherify.models.parameter_order_list_transactions import ParameterOrderListTransactions +from voucherify.models.parameter_order_list_validation_rule_assignments import ParameterOrderListValidationRuleAssignments +from voucherify.models.parameter_order_list_validation_rules import ParameterOrderListValidationRules +from voucherify.models.parameter_order_vouchers import ParameterOrderVouchers +from voucherify.models.parameter_result_list_publications import ParameterResultListPublications +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter +from voucherify.models.parameter_voucher_type_list_publications import ParameterVoucherTypeListPublications +from voucherify.models.points_expiration_types import PointsExpirationTypes +from voucherify.models.product import Product +from voucherify.models.product_collections_create_request_body import ProductCollectionsCreateRequestBody +from voucherify.models.product_collections_create_request_body_filter import ProductCollectionsCreateRequestBodyFilter +from voucherify.models.product_collections_create_request_body_products_item import ProductCollectionsCreateRequestBodyProductsItem +from voucherify.models.product_collections_create_response_body import ProductCollectionsCreateResponseBody +from voucherify.models.product_collections_create_response_body_filter import ProductCollectionsCreateResponseBodyFilter +from voucherify.models.product_collections_create_response_body_products_item import ProductCollectionsCreateResponseBodyProductsItem +from voucherify.models.product_collections_get_response_body import ProductCollectionsGetResponseBody +from voucherify.models.product_collections_get_response_body_filter import ProductCollectionsGetResponseBodyFilter +from voucherify.models.product_collections_get_response_body_products_item import ProductCollectionsGetResponseBodyProductsItem +from voucherify.models.product_collections_item import ProductCollectionsItem +from voucherify.models.product_collections_item_filter import ProductCollectionsItemFilter +from voucherify.models.product_collections_item_products_item import ProductCollectionsItemProductsItem +from voucherify.models.product_collections_list_response_body import ProductCollectionsListResponseBody +from voucherify.models.product_collections_products_list_response_body import ProductCollectionsProductsListResponseBody +from voucherify.models.product_collections_products_list_response_body_data_item import ProductCollectionsProductsListResponseBodyDataItem +from voucherify.models.product_without_skus import ProductWithoutSkus +from voucherify.models.products_create_request_body import ProductsCreateRequestBody +from voucherify.models.products_create_response_body import ProductsCreateResponseBody +from voucherify.models.products_get_response_body import ProductsGetResponseBody +from voucherify.models.products_import_csv_create_response_body import ProductsImportCsvCreateResponseBody +from voucherify.models.products_list_response_body import ProductsListResponseBody +from voucherify.models.products_metadata_update_in_bulk_request_body import ProductsMetadataUpdateInBulkRequestBody +from voucherify.models.products_metadata_update_in_bulk_response_body import ProductsMetadataUpdateInBulkResponseBody +from voucherify.models.products_skus_create_request_body import ProductsSkusCreateRequestBody +from voucherify.models.products_skus_create_response_body import ProductsSkusCreateResponseBody +from voucherify.models.products_skus_list_response_body import ProductsSkusListResponseBody +from voucherify.models.products_skus_update_request_body import ProductsSkusUpdateRequestBody +from voucherify.models.products_skus_update_response_body import ProductsSkusUpdateResponseBody +from voucherify.models.products_update_in_bulk_request_body import ProductsUpdateInBulkRequestBody +from voucherify.models.products_update_in_bulk_response_body import ProductsUpdateInBulkResponseBody +from voucherify.models.products_update_request_body import ProductsUpdateRequestBody +from voucherify.models.products_update_response_body import ProductsUpdateResponseBody +from voucherify.models.promotion_stack import PromotionStack +from voucherify.models.promotion_stack_base import PromotionStackBase +from voucherify.models.promotion_stack_base_tiers import PromotionStackBaseTiers +from voucherify.models.promotion_stack_tiers import PromotionStackTiers +from voucherify.models.promotion_tier import PromotionTier +from voucherify.models.promotion_tier_action import PromotionTierAction +from voucherify.models.promotion_tier_campaign import PromotionTierCampaign +from voucherify.models.promotion_tier_create_params import PromotionTierCreateParams +from voucherify.models.promotion_tier_create_params_action import PromotionTierCreateParamsAction +from voucherify.models.promotion_tier_summary import PromotionTierSummary +from voucherify.models.promotion_tier_summary_orders import PromotionTierSummaryOrders +from voucherify.models.promotion_tier_summary_redemptions import PromotionTierSummaryRedemptions +from voucherify.models.promotion_tiers_list import PromotionTiersList +from voucherify.models.promotions_stacks_create_request_body import PromotionsStacksCreateRequestBody +from voucherify.models.promotions_stacks_create_request_body_tiers import PromotionsStacksCreateRequestBodyTiers +from voucherify.models.promotions_stacks_create_response_body import PromotionsStacksCreateResponseBody +from voucherify.models.promotions_stacks_create_response_body_tiers import PromotionsStacksCreateResponseBodyTiers +from voucherify.models.promotions_stacks_get_response_body import PromotionsStacksGetResponseBody +from voucherify.models.promotions_stacks_get_response_body_tiers import PromotionsStacksGetResponseBodyTiers +from voucherify.models.promotions_stacks_list_response_body import PromotionsStacksListResponseBody +from voucherify.models.promotions_stacks_update_request_body import PromotionsStacksUpdateRequestBody +from voucherify.models.promotions_stacks_update_request_body_tiers import PromotionsStacksUpdateRequestBodyTiers +from voucherify.models.promotions_stacks_update_response_body import PromotionsStacksUpdateResponseBody +from voucherify.models.promotions_stacks_update_response_body_tiers import PromotionsStacksUpdateResponseBodyTiers +from voucherify.models.promotions_tiers_create_request_body import PromotionsTiersCreateRequestBody +from voucherify.models.promotions_tiers_create_request_body_action import PromotionsTiersCreateRequestBodyAction +from voucherify.models.promotions_tiers_create_response_body import PromotionsTiersCreateResponseBody +from voucherify.models.promotions_tiers_create_response_body_action import PromotionsTiersCreateResponseBodyAction +from voucherify.models.promotions_tiers_create_response_body_campaign import PromotionsTiersCreateResponseBodyCampaign +from voucherify.models.promotions_tiers_create_response_body_summary import PromotionsTiersCreateResponseBodySummary +from voucherify.models.promotions_tiers_create_response_body_summary_orders import PromotionsTiersCreateResponseBodySummaryOrders +from voucherify.models.promotions_tiers_create_response_body_summary_redemptions import PromotionsTiersCreateResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_disable_response_body import PromotionsTiersDisableResponseBody +from voucherify.models.promotions_tiers_disable_response_body_action import PromotionsTiersDisableResponseBodyAction +from voucherify.models.promotions_tiers_disable_response_body_campaign import PromotionsTiersDisableResponseBodyCampaign +from voucherify.models.promotions_tiers_disable_response_body_summary import PromotionsTiersDisableResponseBodySummary +from voucherify.models.promotions_tiers_disable_response_body_summary_orders import PromotionsTiersDisableResponseBodySummaryOrders +from voucherify.models.promotions_tiers_disable_response_body_summary_redemptions import PromotionsTiersDisableResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_enable_response_body import PromotionsTiersEnableResponseBody +from voucherify.models.promotions_tiers_enable_response_body_action import PromotionsTiersEnableResponseBodyAction +from voucherify.models.promotions_tiers_enable_response_body_campaign import PromotionsTiersEnableResponseBodyCampaign +from voucherify.models.promotions_tiers_enable_response_body_summary import PromotionsTiersEnableResponseBodySummary +from voucherify.models.promotions_tiers_enable_response_body_summary_orders import PromotionsTiersEnableResponseBodySummaryOrders +from voucherify.models.promotions_tiers_enable_response_body_summary_redemptions import PromotionsTiersEnableResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_get_response_body import PromotionsTiersGetResponseBody +from voucherify.models.promotions_tiers_get_response_body_action import PromotionsTiersGetResponseBodyAction +from voucherify.models.promotions_tiers_get_response_body_campaign import PromotionsTiersGetResponseBodyCampaign +from voucherify.models.promotions_tiers_get_response_body_summary import PromotionsTiersGetResponseBodySummary +from voucherify.models.promotions_tiers_get_response_body_summary_orders import PromotionsTiersGetResponseBodySummaryOrders +from voucherify.models.promotions_tiers_get_response_body_summary_redemptions import PromotionsTiersGetResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_list_response_body import PromotionsTiersListResponseBody +from voucherify.models.promotions_tiers_update_request_body import PromotionsTiersUpdateRequestBody +from voucherify.models.promotions_tiers_update_request_body_action import PromotionsTiersUpdateRequestBodyAction +from voucherify.models.promotions_tiers_update_response_body import PromotionsTiersUpdateResponseBody +from voucherify.models.promotions_tiers_update_response_body_action import PromotionsTiersUpdateResponseBodyAction +from voucherify.models.promotions_tiers_update_response_body_campaign import PromotionsTiersUpdateResponseBodyCampaign +from voucherify.models.promotions_tiers_update_response_body_summary import PromotionsTiersUpdateResponseBodySummary +from voucherify.models.promotions_tiers_update_response_body_summary_orders import PromotionsTiersUpdateResponseBodySummaryOrders +from voucherify.models.promotions_tiers_update_response_body_summary_redemptions import PromotionsTiersUpdateResponseBodySummaryRedemptions +from voucherify.models.publications_create_request_body import PublicationsCreateRequestBody +from voucherify.models.publications_create_request_body_customer import PublicationsCreateRequestBodyCustomer +from voucherify.models.publications_create_request_body_customer_address import PublicationsCreateRequestBodyCustomerAddress +from voucherify.models.publications_create_response_body import PublicationsCreateResponseBody +from voucherify.models.publications_list_response_body import PublicationsListResponseBody +from voucherify.models.publications_list_response_body_publications_item import PublicationsListResponseBodyPublicationsItem +from voucherify.models.publications_list_response_body_publications_item_metadata import PublicationsListResponseBodyPublicationsItemMetadata +from voucherify.models.qualifications_check_eligibility_request_body import QualificationsCheckEligibilityRequestBody +from voucherify.models.qualifications_check_eligibility_response_body import QualificationsCheckEligibilityResponseBody +from voucherify.models.qualifications_field_conditions import QualificationsFieldConditions +from voucherify.models.qualifications_filters_condition import QualificationsFiltersCondition +from voucherify.models.qualifications_option import QualificationsOption +from voucherify.models.qualifications_option_filters import QualificationsOptionFilters +from voucherify.models.qualifications_option_filters_campaign_type import QualificationsOptionFiltersCampaignType +from voucherify.models.qualifications_option_filters_campaign_type_conditions import QualificationsOptionFiltersCampaignTypeConditions +from voucherify.models.qualifications_option_filters_holder_role import QualificationsOptionFiltersHolderRole +from voucherify.models.qualifications_option_filters_holder_role_conditions import QualificationsOptionFiltersHolderRoleConditions +from voucherify.models.qualifications_option_filters_resource_type import QualificationsOptionFiltersResourceType +from voucherify.models.qualifications_option_filters_resource_type_conditions import QualificationsOptionFiltersResourceTypeConditions +from voucherify.models.qualifications_redeemable import QualificationsRedeemable +from voucherify.models.qualifications_redeemable_base import QualificationsRedeemableBase +from voucherify.models.qualifications_redeemables import QualificationsRedeemables +from voucherify.models.redeemable_gift import RedeemableGift +from voucherify.models.redeemable_loyalty_card import RedeemableLoyaltyCard +from voucherify.models.redeemable_result import RedeemableResult +from voucherify.models.redeemable_voucher import RedeemableVoucher +from voucherify.models.redeemable_voucher_gift import RedeemableVoucherGift +from voucherify.models.redeemable_voucher_loyalty_card import RedeemableVoucherLoyaltyCard +from voucherify.models.redeemable_voucher_publish import RedeemableVoucherPublish +from voucherify.models.redeemable_voucher_redemption import RedeemableVoucherRedemption +from voucherify.models.redemption import Redemption +from voucherify.models.redemption_channel import RedemptionChannel +from voucherify.models.redemption_entry import RedemptionEntry +from voucherify.models.redemption_entry_channel import RedemptionEntryChannel +from voucherify.models.redemption_entry_customer import RedemptionEntryCustomer +from voucherify.models.redemption_entry_gift import RedemptionEntryGift +from voucherify.models.redemption_entry_loyalty_card import RedemptionEntryLoyaltyCard +from voucherify.models.redemption_entry_order import RedemptionEntryOrder +from voucherify.models.redemption_entry_order_customer import RedemptionEntryOrderCustomer +from voucherify.models.redemption_entry_order_referrer import RedemptionEntryOrderReferrer +from voucherify.models.redemption_entry_promotion_tier import RedemptionEntryPromotionTier +from voucherify.models.redemption_entry_promotion_tier_action import RedemptionEntryPromotionTierAction +from voucherify.models.redemption_entry_promotion_tier_campaign import RedemptionEntryPromotionTierCampaign +from voucherify.models.redemption_entry_promotion_tier_summary import RedemptionEntryPromotionTierSummary +from voucherify.models.redemption_entry_promotion_tier_summary_orders import RedemptionEntryPromotionTierSummaryOrders +from voucherify.models.redemption_entry_promotion_tier_summary_redemptions import RedemptionEntryPromotionTierSummaryRedemptions +from voucherify.models.redemption_entry_related_redemptions import RedemptionEntryRelatedRedemptions +from voucherify.models.redemption_entry_related_redemptions_redemptions_item import RedemptionEntryRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_entry_related_redemptions_rollbacks_item import RedemptionEntryRelatedRedemptionsRollbacksItem +from voucherify.models.redemption_entry_voucher import RedemptionEntryVoucher +from voucherify.models.redemption_entry_voucher_gift import RedemptionEntryVoucherGift +from voucherify.models.redemption_entry_voucher_loyalty_card import RedemptionEntryVoucherLoyaltyCard +from voucherify.models.redemption_entry_voucher_publish import RedemptionEntryVoucherPublish +from voucherify.models.redemption_entry_voucher_redemption import RedemptionEntryVoucherRedemption +from voucherify.models.redemption_gift import RedemptionGift +from voucherify.models.redemption_loyalty_card import RedemptionLoyaltyCard +from voucherify.models.redemption_related_redemptions import RedemptionRelatedRedemptions +from voucherify.models.redemption_related_redemptions_redemptions_item import RedemptionRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_related_redemptions_rollbacks_item import RedemptionRelatedRedemptionsRollbacksItem +from voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.redemption_reward_result_parameters import RedemptionRewardResultParameters +from voucherify.models.redemption_reward_result_parameters_campaign import RedemptionRewardResultParametersCampaign +from voucherify.models.redemption_reward_result_parameters_coin import RedemptionRewardResultParametersCoin +from voucherify.models.redemption_reward_result_parameters_product import RedemptionRewardResultParametersProduct +from voucherify.models.redemption_rollback import RedemptionRollback +from voucherify.models.redemption_rollback_channel import RedemptionRollbackChannel +from voucherify.models.redemption_rollback_gift import RedemptionRollbackGift +from voucherify.models.redemption_rollback_loyalty_card import RedemptionRollbackLoyaltyCard +from voucherify.models.redemption_rollback_related_redemptions import RedemptionRollbackRelatedRedemptions +from voucherify.models.redemption_rollback_related_redemptions_redemptions_item import RedemptionRollbackRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_rollback_related_redemptions_rollbacks_item import RedemptionRollbackRelatedRedemptionsRollbacksItem +from voucherify.models.redemption_voucher import RedemptionVoucher +from voucherify.models.redemption_voucher_gift import RedemptionVoucherGift +from voucherify.models.redemption_voucher_loyalty_card import RedemptionVoucherLoyaltyCard +from voucherify.models.redemption_voucher_publish import RedemptionVoucherPublish +from voucherify.models.redemption_voucher_redemption import RedemptionVoucherRedemption +from voucherify.models.redemptions_get_response_body import RedemptionsGetResponseBody +from voucherify.models.redemptions_get_response_body_channel import RedemptionsGetResponseBodyChannel +from voucherify.models.redemptions_get_response_body_customer import RedemptionsGetResponseBodyCustomer +from voucherify.models.redemptions_get_response_body_gift import RedemptionsGetResponseBodyGift +from voucherify.models.redemptions_get_response_body_loyalty_card import RedemptionsGetResponseBodyLoyaltyCard +from voucherify.models.redemptions_get_response_body_order import RedemptionsGetResponseBodyOrder +from voucherify.models.redemptions_get_response_body_order_customer import RedemptionsGetResponseBodyOrderCustomer +from voucherify.models.redemptions_get_response_body_order_referrer import RedemptionsGetResponseBodyOrderReferrer +from voucherify.models.redemptions_get_response_body_promotion_tier import RedemptionsGetResponseBodyPromotionTier +from voucherify.models.redemptions_get_response_body_promotion_tier_action import RedemptionsGetResponseBodyPromotionTierAction +from voucherify.models.redemptions_get_response_body_promotion_tier_campaign import RedemptionsGetResponseBodyPromotionTierCampaign +from voucherify.models.redemptions_get_response_body_promotion_tier_summary import RedemptionsGetResponseBodyPromotionTierSummary +from voucherify.models.redemptions_get_response_body_promotion_tier_summary_orders import RedemptionsGetResponseBodyPromotionTierSummaryOrders +from voucherify.models.redemptions_get_response_body_promotion_tier_summary_redemptions import RedemptionsGetResponseBodyPromotionTierSummaryRedemptions +from voucherify.models.redemptions_get_response_body_related_redemptions import RedemptionsGetResponseBodyRelatedRedemptions +from voucherify.models.redemptions_get_response_body_related_redemptions_redemptions_item import RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_get_response_body_related_redemptions_rollbacks_item import RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem +from voucherify.models.redemptions_get_response_body_voucher import RedemptionsGetResponseBodyVoucher +from voucherify.models.redemptions_get_response_body_voucher_gift import RedemptionsGetResponseBodyVoucherGift +from voucherify.models.redemptions_get_response_body_voucher_loyalty_card import RedemptionsGetResponseBodyVoucherLoyaltyCard +from voucherify.models.redemptions_get_response_body_voucher_publish import RedemptionsGetResponseBodyVoucherPublish +from voucherify.models.redemptions_get_response_body_voucher_redemption import RedemptionsGetResponseBodyVoucherRedemption +from voucherify.models.redemptions_list_response_body import RedemptionsListResponseBody +from voucherify.models.redemptions_list_response_body_redemptions_item import RedemptionsListResponseBodyRedemptionsItem +from voucherify.models.redemptions_list_response_body_redemptions_item_channel import RedemptionsListResponseBodyRedemptionsItemChannel +from voucherify.models.redemptions_list_response_body_redemptions_item_customer import RedemptionsListResponseBodyRedemptionsItemCustomer +from voucherify.models.redemptions_list_response_body_redemptions_item_gift import RedemptionsListResponseBodyRedemptionsItemGift +from voucherify.models.redemptions_list_response_body_redemptions_item_loyalty_card import RedemptionsListResponseBodyRedemptionsItemLoyaltyCard +from voucherify.models.redemptions_list_response_body_redemptions_item_order import RedemptionsListResponseBodyRedemptionsItemOrder +from voucherify.models.redemptions_list_response_body_redemptions_item_order_customer import RedemptionsListResponseBodyRedemptionsItemOrderCustomer +from voucherify.models.redemptions_list_response_body_redemptions_item_order_referrer import RedemptionsListResponseBodyRedemptionsItemOrderReferrer +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier import RedemptionsListResponseBodyRedemptionsItemPromotionTier +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_action import RedemptionsListResponseBodyRedemptionsItemPromotionTierAction +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_campaign import RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher import RedemptionsListResponseBodyRedemptionsItemVoucher +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_gift import RedemptionsListResponseBodyRedemptionsItemVoucherGift +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_loyalty_card import RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_publish import RedemptionsListResponseBodyRedemptionsItemVoucherPublish +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_redemption import RedemptionsListResponseBodyRedemptionsItemVoucherRedemption +from voucherify.models.redemptions_redeem_request_body import RedemptionsRedeemRequestBody +from voucherify.models.redemptions_redeem_request_body_options import RedemptionsRedeemRequestBodyOptions +from voucherify.models.redemptions_redeem_request_body_redeemables_item import RedemptionsRedeemRequestBodyRedeemablesItem +from voucherify.models.redemptions_redeem_request_body_redeemables_item_gift import RedemptionsRedeemRequestBodyRedeemablesItemGift +from voucherify.models.redemptions_redeem_request_body_redeemables_item_reward import RedemptionsRedeemRequestBodyRedeemablesItemReward +from voucherify.models.redemptions_redeem_response_body import RedemptionsRedeemResponseBody +from voucherify.models.redemptions_rollback_create_request_body import RedemptionsRollbackCreateRequestBody +from voucherify.models.redemptions_rollback_create_response_body import RedemptionsRollbackCreateResponseBody +from voucherify.models.redemptions_rollback_create_response_body_channel import RedemptionsRollbackCreateResponseBodyChannel +from voucherify.models.redemptions_rollback_create_response_body_gift import RedemptionsRollbackCreateResponseBodyGift +from voucherify.models.redemptions_rollback_create_response_body_loyalty_card import RedemptionsRollbackCreateResponseBodyLoyaltyCard +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions import RedemptionsRollbackCreateResponseBodyRelatedRedemptions +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions_redemptions_item import RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions_rollbacks_item import RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem +from voucherify.models.redemptions_rollbacks_create_request_body import RedemptionsRollbacksCreateRequestBody +from voucherify.models.redemptions_rollbacks_create_response_body import RedemptionsRollbacksCreateResponseBody +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.referral_program_custom_event import ReferralProgramCustomEvent +from voucherify.models.referral_program_referee_reward import ReferralProgramRefereeReward +from voucherify.models.referral_program_referee_reward_related_object_parent import ReferralProgramRefereeRewardRelatedObjectParent +from voucherify.models.referrer import Referrer +from voucherify.models.referrer_address import ReferrerAddress +from voucherify.models.referrer_id import ReferrerId +from voucherify.models.resource_types import ResourceTypes +from voucherify.models.reward import Reward +from voucherify.models.reward_assignment import RewardAssignment +from voucherify.models.reward_assignment_parameters import RewardAssignmentParameters +from voucherify.models.reward_assignment_parameters_loyalty import RewardAssignmentParametersLoyalty +from voucherify.models.reward_attributes import RewardAttributes +from voucherify.models.reward_type import RewardType +from voucherify.models.reward_type_campaign import RewardTypeCampaign +from voucherify.models.reward_type_coin import RewardTypeCoin +from voucherify.models.reward_type_product import RewardTypeProduct +from voucherify.models.rewards_assignments_create_request_body import RewardsAssignmentsCreateRequestBody +from voucherify.models.rewards_assignments_create_request_body_parameters import RewardsAssignmentsCreateRequestBodyParameters +from voucherify.models.rewards_assignments_create_request_body_parameters_loyalty import RewardsAssignmentsCreateRequestBodyParametersLoyalty +from voucherify.models.rewards_assignments_create_response_body import RewardsAssignmentsCreateResponseBody +from voucherify.models.rewards_assignments_create_response_body_parameters import RewardsAssignmentsCreateResponseBodyParameters +from voucherify.models.rewards_assignments_create_response_body_parameters_loyalty import RewardsAssignmentsCreateResponseBodyParametersLoyalty +from voucherify.models.rewards_assignments_get_response_body import RewardsAssignmentsGetResponseBody +from voucherify.models.rewards_assignments_get_response_body_parameters import RewardsAssignmentsGetResponseBodyParameters +from voucherify.models.rewards_assignments_get_response_body_parameters_loyalty import RewardsAssignmentsGetResponseBodyParametersLoyalty +from voucherify.models.rewards_assignments_list_response_body import RewardsAssignmentsListResponseBody +from voucherify.models.rewards_assignments_update_request_body import RewardsAssignmentsUpdateRequestBody +from voucherify.models.rewards_assignments_update_request_body_parameters import RewardsAssignmentsUpdateRequestBodyParameters +from voucherify.models.rewards_assignments_update_request_body_parameters_loyalty import RewardsAssignmentsUpdateRequestBodyParametersLoyalty +from voucherify.models.rewards_assignments_update_response_body import RewardsAssignmentsUpdateResponseBody +from voucherify.models.rewards_assignments_update_response_body_parameters import RewardsAssignmentsUpdateResponseBodyParameters +from voucherify.models.rewards_assignments_update_response_body_parameters_loyalty import RewardsAssignmentsUpdateResponseBodyParametersLoyalty +from voucherify.models.rewards_create_request_body import RewardsCreateRequestBody +from voucherify.models.rewards_create_request_body_attributes import RewardsCreateRequestBodyAttributes +from voucherify.models.rewards_create_request_body_parameters import RewardsCreateRequestBodyParameters +from voucherify.models.rewards_create_request_body_parameters_campaign import RewardsCreateRequestBodyParametersCampaign +from voucherify.models.rewards_create_request_body_parameters_coin import RewardsCreateRequestBodyParametersCoin +from voucherify.models.rewards_create_request_body_parameters_product import RewardsCreateRequestBodyParametersProduct +from voucherify.models.rewards_create_response_body import RewardsCreateResponseBody +from voucherify.models.rewards_create_response_body_attributes import RewardsCreateResponseBodyAttributes +from voucherify.models.rewards_list_response_body import RewardsListResponseBody +from voucherify.models.rewards_update_request_body import RewardsUpdateRequestBody +from voucherify.models.rewards_update_request_body_attributes import RewardsUpdateRequestBodyAttributes +from voucherify.models.rewards_update_request_body_parameters import RewardsUpdateRequestBodyParameters +from voucherify.models.rewards_update_request_body_parameters_campaign import RewardsUpdateRequestBodyParametersCampaign +from voucherify.models.rewards_update_request_body_parameters_coin import RewardsUpdateRequestBodyParametersCoin +from voucherify.models.rewards_update_request_body_parameters_product import RewardsUpdateRequestBodyParametersProduct +from voucherify.models.rewards_update_response_body import RewardsUpdateResponseBody +from voucherify.models.rewards_update_response_body_attributes import RewardsUpdateResponseBodyAttributes +from voucherify.models.segments_create_request_body import SegmentsCreateRequestBody +from voucherify.models.segments_create_response_body import SegmentsCreateResponseBody +from voucherify.models.segments_get_response_body import SegmentsGetResponseBody +from voucherify.models.session import Session +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.simple_customer_required_object_type import SimpleCustomerRequiredObjectType +from voucherify.models.simple_loyalty_card import SimpleLoyaltyCard +from voucherify.models.simple_product_discount_unit import SimpleProductDiscountUnit +from voucherify.models.simple_segment import SimpleSegment +from voucherify.models.simple_sku_discount_unit import SimpleSkuDiscountUnit +from voucherify.models.simple_voucher import SimpleVoucher +from voucherify.models.simple_voucher_redemption import SimpleVoucherRedemption +from voucherify.models.sku import Sku +from voucherify.models.skus_get_response_body import SkusGetResponseBody +from voucherify.models.skus_import_csv_create_response_body import SkusImportCsvCreateResponseBody +from voucherify.models.skus_list_for_product import SkusListForProduct +from voucherify.models.stacking_rules import StackingRules +from voucherify.models.validation_rule import ValidationRule +from voucherify.models.validation_rule_applicable_to import ValidationRuleApplicableTo +from voucherify.models.validation_rule_assignment import ValidationRuleAssignment +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validation_rule_error import ValidationRuleError +from voucherify.models.validation_rules_assignments_create_request_body import ValidationRulesAssignmentsCreateRequestBody +from voucherify.models.validation_rules_assignments_create_response_body import ValidationRulesAssignmentsCreateResponseBody +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validation_rules_assignments_list_response_body import ValidationRulesAssignmentsListResponseBody +from voucherify.models.validation_rules_create_request_body import ValidationRulesCreateRequestBody +from voucherify.models.validation_rules_create_request_body_applicable_to import ValidationRulesCreateRequestBodyApplicableTo +from voucherify.models.validation_rules_create_request_body_error import ValidationRulesCreateRequestBodyError +from voucherify.models.validation_rules_create_response_body import ValidationRulesCreateResponseBody +from voucherify.models.validation_rules_create_response_body_applicable_to import ValidationRulesCreateResponseBodyApplicableTo +from voucherify.models.validation_rules_create_response_body_error import ValidationRulesCreateResponseBodyError +from voucherify.models.validation_rules_get_response_body import ValidationRulesGetResponseBody +from voucherify.models.validation_rules_get_response_body_applicable_to import ValidationRulesGetResponseBodyApplicableTo +from voucherify.models.validation_rules_get_response_body_error import ValidationRulesGetResponseBodyError +from voucherify.models.validation_rules_list_response_body import ValidationRulesListResponseBody +from voucherify.models.validation_rules_update_request_body import ValidationRulesUpdateRequestBody +from voucherify.models.validation_rules_update_request_body_applicable_to import ValidationRulesUpdateRequestBodyApplicableTo +from voucherify.models.validation_rules_update_request_body_error import ValidationRulesUpdateRequestBodyError +from voucherify.models.validation_rules_update_response_body import ValidationRulesUpdateResponseBody +from voucherify.models.validation_rules_update_response_body_applicable_to import ValidationRulesUpdateResponseBodyApplicableTo +from voucherify.models.validation_rules_update_response_body_error import ValidationRulesUpdateResponseBodyError +from voucherify.models.validations_redeemable_inapplicable import ValidationsRedeemableInapplicable +from voucherify.models.validations_redeemable_inapplicable_result import ValidationsRedeemableInapplicableResult +from voucherify.models.validations_redeemable_inapplicable_result_details import ValidationsRedeemableInapplicableResultDetails +from voucherify.models.validations_redeemable_skipped import ValidationsRedeemableSkipped +from voucherify.models.validations_redeemable_skipped_result import ValidationsRedeemableSkippedResult +from voucherify.models.validations_redeemable_skipped_result_details import ValidationsRedeemableSkippedResultDetails +from voucherify.models.validations_validate_request_body import ValidationsValidateRequestBody +from voucherify.models.validations_validate_request_body_options import ValidationsValidateRequestBodyOptions +from voucherify.models.validations_validate_request_body_redeemables_item import ValidationsValidateRequestBodyRedeemablesItem +from voucherify.models.validations_validate_request_body_redeemables_item_gift import ValidationsValidateRequestBodyRedeemablesItemGift +from voucherify.models.validations_validate_request_body_redeemables_item_reward import ValidationsValidateRequestBodyRedeemablesItemReward +from voucherify.models.validations_validate_response_body import ValidationsValidateResponseBody +from voucherify.models.validations_validate_response_body_redeemables_item import ValidationsValidateResponseBodyRedeemablesItem +from voucherify.models.validations_validate_response_body_redeemables_item_result import ValidationsValidateResponseBodyRedeemablesItemResult +from voucherify.models.validations_validate_response_body_redeemables_item_result_details import ValidationsValidateResponseBodyRedeemablesItemResultDetails +from voucherify.models.validations_validate_response_body_redeemables_item_result_discount import ValidationsValidateResponseBodyRedeemablesItemResultDiscount +from voucherify.models.validations_validate_response_body_redeemables_item_result_discount_product import ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct +from voucherify.models.validations_validate_response_body_redeemables_item_result_gift import ValidationsValidateResponseBodyRedeemablesItemResultGift +from voucherify.models.validations_validate_response_body_redeemables_item_result_loyalty_card import ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_hours_daily_item import ValidityHoursDailyItem +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher import Voucher +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.voucher_assets_barcode import VoucherAssetsBarcode +from voucherify.models.voucher_assets_qr import VoucherAssetsQr +from voucherify.models.voucher_gift import VoucherGift +from voucherify.models.voucher_loyalty_card import VoucherLoyaltyCard +from voucherify.models.voucher_publish import VoucherPublish +from voucherify.models.voucher_redemption import VoucherRedemption +from voucherify.models.voucher_transaction import VoucherTransaction +from voucherify.models.voucher_transaction_details import VoucherTransactionDetails +from voucherify.models.voucher_transaction_details_balance import VoucherTransactionDetailsBalance +from voucherify.models.voucher_transaction_details_balance_related_object import VoucherTransactionDetailsBalanceRelatedObject +from voucherify.models.voucher_transaction_details_custom_event import VoucherTransactionDetailsCustomEvent +from voucherify.models.voucher_transaction_details_earning_rule import VoucherTransactionDetailsEarningRule +from voucherify.models.voucher_transaction_details_earning_rule_source import VoucherTransactionDetailsEarningRuleSource +from voucherify.models.voucher_transaction_details_event import VoucherTransactionDetailsEvent +from voucherify.models.voucher_transaction_details_event_schema import VoucherTransactionDetailsEventSchema +from voucherify.models.voucher_transaction_details_loyalty_tier import VoucherTransactionDetailsLoyaltyTier +from voucherify.models.voucher_transaction_details_order import VoucherTransactionDetailsOrder +from voucherify.models.voucher_transaction_details_redemption import VoucherTransactionDetailsRedemption +from voucherify.models.voucher_transaction_details_reward import VoucherTransactionDetailsReward +from voucherify.models.voucher_transaction_details_rollback import VoucherTransactionDetailsRollback +from voucherify.models.voucher_transaction_details_segment import VoucherTransactionDetailsSegment +from voucherify.models.voucher_transactions_export_filter_conditions import VoucherTransactionsExportFilterConditions +from voucherify.models.voucher_transactions_export_filter_conditions_voucher_id import VoucherTransactionsExportFilterConditionsVoucherId +from voucherify.models.voucher_transactions_export_filter_conditions_voucher_id_conditions import VoucherTransactionsExportFilterConditionsVoucherIdConditions +from voucherify.models.voucher_transactions_export_parameters import VoucherTransactionsExportParameters +from voucherify.models.voucher_transactions_filters import VoucherTransactionsFilters +from voucherify.models.voucher_with_categories import VoucherWithCategories +from voucherify.models.voucher_with_categories_gift import VoucherWithCategoriesGift +from voucherify.models.voucher_with_categories_loyalty_card import VoucherWithCategoriesLoyaltyCard +from voucherify.models.voucher_with_categories_publish import VoucherWithCategoriesPublish +from voucherify.models.voucher_with_categories_redemption import VoucherWithCategoriesRedemption +from voucherify.models.vouchers_balance_update_request_body import VouchersBalanceUpdateRequestBody +from voucherify.models.vouchers_balance_update_response_body import VouchersBalanceUpdateResponseBody +from voucherify.models.vouchers_balance_update_response_body_related_object import VouchersBalanceUpdateResponseBodyRelatedObject +from voucherify.models.vouchers_create_response_body import VouchersCreateResponseBody +from voucherify.models.vouchers_create_response_body_gift import VouchersCreateResponseBodyGift +from voucherify.models.vouchers_create_response_body_loyalty_card import VouchersCreateResponseBodyLoyaltyCard +from voucherify.models.vouchers_create_response_body_publish import VouchersCreateResponseBodyPublish +from voucherify.models.vouchers_create_response_body_redemption import VouchersCreateResponseBodyRedemption +from voucherify.models.vouchers_create_with_specific_code_request_body import VouchersCreateWithSpecificCodeRequestBody +from voucherify.models.vouchers_create_with_specific_code_request_body_redemption import VouchersCreateWithSpecificCodeRequestBodyRedemption +from voucherify.models.vouchers_disable_response_body import VouchersDisableResponseBody +from voucherify.models.vouchers_disable_response_body_gift import VouchersDisableResponseBodyGift +from voucherify.models.vouchers_disable_response_body_loyalty_card import VouchersDisableResponseBodyLoyaltyCard +from voucherify.models.vouchers_disable_response_body_publish import VouchersDisableResponseBodyPublish +from voucherify.models.vouchers_disable_response_body_redemption import VouchersDisableResponseBodyRedemption +from voucherify.models.vouchers_enable_response_body import VouchersEnableResponseBody +from voucherify.models.vouchers_enable_response_body_gift import VouchersEnableResponseBodyGift +from voucherify.models.vouchers_enable_response_body_loyalty_card import VouchersEnableResponseBodyLoyaltyCard +from voucherify.models.vouchers_enable_response_body_publish import VouchersEnableResponseBodyPublish +from voucherify.models.vouchers_enable_response_body_redemption import VouchersEnableResponseBodyRedemption +from voucherify.models.vouchers_get_response_body import VouchersGetResponseBody +from voucherify.models.vouchers_get_response_body_gift import VouchersGetResponseBodyGift +from voucherify.models.vouchers_get_response_body_loyalty_card import VouchersGetResponseBodyLoyaltyCard +from voucherify.models.vouchers_get_response_body_publish import VouchersGetResponseBodyPublish +from voucherify.models.vouchers_get_response_body_redemption import VouchersGetResponseBodyRedemption +from voucherify.models.vouchers_import_create_item_request_body import VouchersImportCreateItemRequestBody +from voucherify.models.vouchers_import_create_item_request_body_redemption import VouchersImportCreateItemRequestBodyRedemption +from voucherify.models.vouchers_import_create_response_body import VouchersImportCreateResponseBody +from voucherify.models.vouchers_import_csv_create_response_body import VouchersImportCsvCreateResponseBody +from voucherify.models.vouchers_list_response_body import VouchersListResponseBody +from voucherify.models.vouchers_metadata_update_in_bulk_request_body import VouchersMetadataUpdateInBulkRequestBody +from voucherify.models.vouchers_metadata_update_in_bulk_response_body import VouchersMetadataUpdateInBulkResponseBody +from voucherify.models.vouchers_redemption_get_response_body import VouchersRedemptionGetResponseBody +from voucherify.models.vouchers_transactions_export_create_request_body import VouchersTransactionsExportCreateRequestBody +from voucherify.models.vouchers_transactions_export_create_response_body import VouchersTransactionsExportCreateResponseBody +from voucherify.models.vouchers_transactions_export_create_response_body_result import VouchersTransactionsExportCreateResponseBodyResult +from voucherify.models.vouchers_transactions_list_response_body import VouchersTransactionsListResponseBody +from voucherify.models.vouchers_update_in_bulk_item_request_body import VouchersUpdateInBulkItemRequestBody +from voucherify.models.vouchers_update_in_bulk_response_body import VouchersUpdateInBulkResponseBody +from voucherify.models.vouchers_update_request_body import VouchersUpdateRequestBody +from voucherify.models.vouchers_update_response_body import VouchersUpdateResponseBody +from voucherify.models.vouchers_update_response_body_gift import VouchersUpdateResponseBodyGift +from voucherify.models.vouchers_update_response_body_loyalty_card import VouchersUpdateResponseBodyLoyaltyCard +from voucherify.models.vouchers_update_response_body_publish import VouchersUpdateResponseBodyPublish +from voucherify.models.vouchers_update_response_body_redemption import VouchersUpdateResponseBodyRedemption diff --git a/voucherify/api/__init__.py b/voucherify/api/__init__.py new file mode 100644 index 00000000..66ca31b2 --- /dev/null +++ b/voucherify/api/__init__.py @@ -0,0 +1,24 @@ +# flake8: noqa + +# import apis into api package +from voucherify.api.async_actions_api import AsyncActionsApi +from voucherify.api.campaigns_api import CampaignsApi +from voucherify.api.categories_api import CategoriesApi +from voucherify.api.client_side_api import ClientSideApi +from voucherify.api.customers_api import CustomersApi +from voucherify.api.events_api import EventsApi +from voucherify.api.exports_api import ExportsApi +from voucherify.api.loyalties_api import LoyaltiesApi +from voucherify.api.orders_api import OrdersApi +from voucherify.api.product_collections_api import ProductCollectionsApi +from voucherify.api.products_api import ProductsApi +from voucherify.api.promotions_api import PromotionsApi +from voucherify.api.publications_api import PublicationsApi +from voucherify.api.qualifications_api import QualificationsApi +from voucherify.api.redemptions_api import RedemptionsApi +from voucherify.api.rewards_api import RewardsApi +from voucherify.api.segments_api import SegmentsApi +from voucherify.api.validation_rules_api import ValidationRulesApi +from voucherify.api.validations_api import ValidationsApi +from voucherify.api.vouchers_api import VouchersApi + diff --git a/voucherify/api/async_actions_api.py b/voucherify/api/async_actions_api.py new file mode 100644 index 00000000..0f254f2f --- /dev/null +++ b/voucherify/api/async_actions_api.py @@ -0,0 +1,590 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from datetime import datetime +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.async_action_get_response_body import AsyncActionGetResponseBody +from voucherify.models.async_actions_list_response_body import AsyncActionsListResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class AsyncActionsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_async_action( + self, + async_action_id: Annotated[StrictStr, Field(description="Unique ID of the asynchronous operation.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AsyncActionGetResponseBody: + """Get Async Action + + Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + + :param async_action_id: Unique ID of the asynchronous operation. (required) + :type async_action_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_async_action_serialize( + async_action_id=async_action_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "AsyncActionGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_async_action_with_http_info( + self, + async_action_id: Annotated[StrictStr, Field(description="Unique ID of the asynchronous operation.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AsyncActionGetResponseBody]: + """Get Async Action + + Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + + :param async_action_id: Unique ID of the asynchronous operation. (required) + :type async_action_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_async_action_serialize( + async_action_id=async_action_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "AsyncActionGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_async_action_without_preload_content( + self, + async_action_id: Annotated[StrictStr, Field(description="Unique ID of the asynchronous operation.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Async Action + + Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + + :param async_action_id: Unique ID of the asynchronous operation. (required) + :type async_action_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_async_action_serialize( + async_action_id=async_action_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "AsyncActionGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_async_action_serialize( + self, + async_action_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if async_action_id is not None: + _path_params['asyncActionId'] = async_action_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/async-actions/{asyncActionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_async_actions( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limit the number of asynchronous actions that the API returns in the response.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AsyncActionsListResponseBody: + """List Async Actions + + Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + + :param limit: Limit the number of asynchronous actions that the API returns in the response. + :type limit: int + :param end_date: Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_async_actions_serialize( + limit=limit, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "AsyncActionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_async_actions_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limit the number of asynchronous actions that the API returns in the response.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AsyncActionsListResponseBody]: + """List Async Actions + + Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + + :param limit: Limit the number of asynchronous actions that the API returns in the response. + :type limit: int + :param end_date: Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_async_actions_serialize( + limit=limit, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "AsyncActionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_async_actions_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limit the number of asynchronous actions that the API returns in the response.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Async Actions + + Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import). + + :param limit: Limit the number of asynchronous actions that the API returns in the response. + :type limit: int + :param end_date: Limits results to actions scheduled before the end_date. The date format needs to be consistent with ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_async_actions_serialize( + limit=limit, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "AsyncActionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_async_actions_serialize( + self, + limit, + end_date, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if end_date is not None: + if isinstance(end_date, datetime): + _query_params.append( + ( + 'end_date', + end_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('end_date', end_date)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/async-actions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/campaigns_api.py b/voucherify/api/campaigns_api.py new file mode 100644 index 00000000..50b3f114 --- /dev/null +++ b/voucherify/api/campaigns_api.py @@ -0,0 +1,3189 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr +from typing import Any, Dict, List, Optional, Union +from typing_extensions import Annotated +from voucherify.models.campaigns_create_request_body import CampaignsCreateRequestBody +from voucherify.models.campaigns_create_response_body import CampaignsCreateResponseBody +from voucherify.models.campaigns_delete_response_body import CampaignsDeleteResponseBody +from voucherify.models.campaigns_get_response_body import CampaignsGetResponseBody +from voucherify.models.campaigns_import_create_response_body import CampaignsImportCreateResponseBody +from voucherify.models.campaigns_import_csv_create_response_body import CampaignsImportCsvCreateResponseBody +from voucherify.models.campaigns_import_voucher_item import CampaignsImportVoucherItem +from voucherify.models.campaigns_list_response_body import CampaignsListResponseBody +from voucherify.models.campaigns_update_request_body import CampaignsUpdateRequestBody +from voucherify.models.campaigns_update_response_body import CampaignsUpdateResponseBody +from voucherify.models.campaigns_vouchers_create_combined_response_body import CampaignsVouchersCreateCombinedResponseBody +from voucherify.models.campaigns_vouchers_create_in_bulk_request_body import CampaignsVouchersCreateInBulkRequestBody +from voucherify.models.campaigns_vouchers_create_request_body import CampaignsVouchersCreateRequestBody +from voucherify.models.campaigns_vouchers_create_response_body import CampaignsVouchersCreateResponseBody +from voucherify.models.parameter_campaign_type import ParameterCampaignType +from voucherify.models.parameter_expand_list_campaigns import ParameterExpandListCampaigns +from voucherify.models.parameter_order_list_campaigns import ParameterOrderListCampaigns + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class CampaignsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def add_voucher_with_specific_code_to_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + code: Annotated[StrictStr, Field(description="A custom **code** that identifies the voucher.")], + campaigns_vouchers_create_request_body: Annotated[Optional[CampaignsVouchersCreateRequestBody], Field(description="Specify the voucher parameters that you would like to overwrite.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsVouchersCreateResponseBody: + """Add Voucher with Specific Code to Campaign + + This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign. + + :param campaign_id: The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param code: A custom **code** that identifies the voucher. (required) + :type code: str + :param campaigns_vouchers_create_request_body: Specify the voucher parameters that you would like to overwrite. + :type campaigns_vouchers_create_request_body: CampaignsVouchersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_voucher_with_specific_code_to_campaign_serialize( + campaign_id=campaign_id, + code=code, + campaigns_vouchers_create_request_body=campaigns_vouchers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsVouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_voucher_with_specific_code_to_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + code: Annotated[StrictStr, Field(description="A custom **code** that identifies the voucher.")], + campaigns_vouchers_create_request_body: Annotated[Optional[CampaignsVouchersCreateRequestBody], Field(description="Specify the voucher parameters that you would like to overwrite.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsVouchersCreateResponseBody]: + """Add Voucher with Specific Code to Campaign + + This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign. + + :param campaign_id: The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param code: A custom **code** that identifies the voucher. (required) + :type code: str + :param campaigns_vouchers_create_request_body: Specify the voucher parameters that you would like to overwrite. + :type campaigns_vouchers_create_request_body: CampaignsVouchersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_voucher_with_specific_code_to_campaign_serialize( + campaign_id=campaign_id, + code=code, + campaigns_vouchers_create_request_body=campaigns_vouchers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsVouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_voucher_with_specific_code_to_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + code: Annotated[StrictStr, Field(description="A custom **code** that identifies the voucher.")], + campaigns_vouchers_create_request_body: Annotated[Optional[CampaignsVouchersCreateRequestBody], Field(description="Specify the voucher parameters that you would like to overwrite.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add Voucher with Specific Code to Campaign + + This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign. + + :param campaign_id: The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param code: A custom **code** that identifies the voucher. (required) + :type code: str + :param campaigns_vouchers_create_request_body: Specify the voucher parameters that you would like to overwrite. + :type campaigns_vouchers_create_request_body: CampaignsVouchersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_voucher_with_specific_code_to_campaign_serialize( + campaign_id=campaign_id, + code=code, + campaigns_vouchers_create_request_body=campaigns_vouchers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsVouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_voucher_with_specific_code_to_campaign_serialize( + self, + campaign_id, + code, + campaigns_vouchers_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if campaigns_vouchers_create_request_body is not None: + _body_params = campaigns_vouchers_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/campaigns/{campaignId}/vouchers/{code}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def add_vouchers_to_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + vouchers_count: Annotated[Optional[StrictInt], Field(description="Number of vouchers that should be added.")] = None, + campaigns_vouchers_create_in_bulk_request_body: Annotated[Optional[CampaignsVouchersCreateInBulkRequestBody], Field(description="Specify the voucher parameters that you would like to overwrite.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsVouchersCreateCombinedResponseBody: + """Add Vouchers to Campaign + + This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional code_config parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param vouchers_count: Number of vouchers that should be added. + :type vouchers_count: int + :param campaigns_vouchers_create_in_bulk_request_body: Specify the voucher parameters that you would like to overwrite. + :type campaigns_vouchers_create_in_bulk_request_body: CampaignsVouchersCreateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_vouchers_to_campaign_serialize( + campaign_id=campaign_id, + vouchers_count=vouchers_count, + campaigns_vouchers_create_in_bulk_request_body=campaigns_vouchers_create_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsVouchersCreateCombinedResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_vouchers_to_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + vouchers_count: Annotated[Optional[StrictInt], Field(description="Number of vouchers that should be added.")] = None, + campaigns_vouchers_create_in_bulk_request_body: Annotated[Optional[CampaignsVouchersCreateInBulkRequestBody], Field(description="Specify the voucher parameters that you would like to overwrite.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsVouchersCreateCombinedResponseBody]: + """Add Vouchers to Campaign + + This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional code_config parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param vouchers_count: Number of vouchers that should be added. + :type vouchers_count: int + :param campaigns_vouchers_create_in_bulk_request_body: Specify the voucher parameters that you would like to overwrite. + :type campaigns_vouchers_create_in_bulk_request_body: CampaignsVouchersCreateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_vouchers_to_campaign_serialize( + campaign_id=campaign_id, + vouchers_count=vouchers_count, + campaigns_vouchers_create_in_bulk_request_body=campaigns_vouchers_create_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsVouchersCreateCombinedResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_vouchers_to_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + vouchers_count: Annotated[Optional[StrictInt], Field(description="Number of vouchers that should be added.")] = None, + campaigns_vouchers_create_in_bulk_request_body: Annotated[Optional[CampaignsVouchersCreateInBulkRequestBody], Field(description="Specify the voucher parameters that you would like to overwrite.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add Vouchers to Campaign + + This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional code_config parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param vouchers_count: Number of vouchers that should be added. + :type vouchers_count: int + :param campaigns_vouchers_create_in_bulk_request_body: Specify the voucher parameters that you would like to overwrite. + :type campaigns_vouchers_create_in_bulk_request_body: CampaignsVouchersCreateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_vouchers_to_campaign_serialize( + campaign_id=campaign_id, + vouchers_count=vouchers_count, + campaigns_vouchers_create_in_bulk_request_body=campaigns_vouchers_create_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsVouchersCreateCombinedResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_vouchers_to_campaign_serialize( + self, + campaign_id, + vouchers_count, + campaigns_vouchers_create_in_bulk_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if vouchers_count is not None: + + _query_params.append(('vouchers_count', vouchers_count)) + + # process the header parameters + # process the form parameters + # process the body parameter + if campaigns_vouchers_create_in_bulk_request_body is not None: + _body_params = campaigns_vouchers_create_in_bulk_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/campaigns/{campaignId}/vouchers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_campaign( + self, + campaigns_create_request_body: Annotated[Optional[CampaignsCreateRequestBody], Field(description="Specify the details of the campaign that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsCreateResponseBody: + """Create Campaign + + Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. ๐Ÿ“˜ Global uniqueness All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. ๐Ÿšง Code generation status This is an asynchronous action; you cant read or modify a newly created campaign until the code generation is completed. See the creation_status field in the campaign object description. + + :param campaigns_create_request_body: Specify the details of the campaign that you would like to create. + :type campaigns_create_request_body: CampaignsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_campaign_serialize( + campaigns_create_request_body=campaigns_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_campaign_with_http_info( + self, + campaigns_create_request_body: Annotated[Optional[CampaignsCreateRequestBody], Field(description="Specify the details of the campaign that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsCreateResponseBody]: + """Create Campaign + + Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. ๐Ÿ“˜ Global uniqueness All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. ๐Ÿšง Code generation status This is an asynchronous action; you cant read or modify a newly created campaign until the code generation is completed. See the creation_status field in the campaign object description. + + :param campaigns_create_request_body: Specify the details of the campaign that you would like to create. + :type campaigns_create_request_body: CampaignsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_campaign_serialize( + campaigns_create_request_body=campaigns_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_campaign_without_preload_content( + self, + campaigns_create_request_body: Annotated[Optional[CampaignsCreateRequestBody], Field(description="Specify the details of the campaign that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Campaign + + Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. ๐Ÿ“˜ Global uniqueness All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. ๐Ÿšง Code generation status This is an asynchronous action; you cant read or modify a newly created campaign until the code generation is completed. See the creation_status field in the campaign object description. + + :param campaigns_create_request_body: Specify the details of the campaign that you would like to create. + :type campaigns_create_request_body: CampaignsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_campaign_serialize( + campaigns_create_request_body=campaigns_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_campaign_serialize( + self, + campaigns_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if campaigns_create_request_body is not None: + _body_params = campaigns_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/campaigns', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsDeleteResponseBody: + """Delete Campaign + + Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param force: If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_campaign_serialize( + campaign_id=campaign_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsDeleteResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsDeleteResponseBody]: + """Delete Campaign + + Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param force: If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_campaign_serialize( + campaign_id=campaign_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsDeleteResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Campaign + + Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param force: If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the campaign and related vouchers will be moved to the bin. Going forward, the user will be able to create the next campaign with exactly the same name. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_campaign_serialize( + campaign_id=campaign_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsDeleteResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_campaign_serialize( + self, + campaign_id, + force, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if force is not None: + + _query_params.append(('force', force)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/campaigns/{campaignId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def disable_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> object: + """Disable Campaign + + There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. + + :param campaign_id: The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def disable_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[object]: + """Disable Campaign + + There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. + + :param campaign_id: The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def disable_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disable Campaign + + There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed. + + :param campaign_id: The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _disable_campaign_serialize( + self, + campaign_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/campaigns/{campaignId}/disable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def enable_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> object: + """Enable Campaign + + There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. + + :param campaign_id: The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def enable_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[object]: + """Enable Campaign + + There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. + + :param campaign_id: The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def enable_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enable Campaign + + There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. Sets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired. + + :param campaign_id: The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "object", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _enable_campaign_serialize( + self, + campaign_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/campaigns/{campaignId}/enable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsGetResponseBody: + """Get Campaign + + Retrieves the campaign with the given campaign ID or campaign name. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsGetResponseBody]: + """Get Campaign + + Retrieves the campaign with the given campaign ID or campaign name. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Campaign + + Retrieves the campaign with the given campaign ID or campaign name. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_campaign_serialize( + self, + campaign_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/campaigns/{campaignId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_vouchers_to_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + campaigns_import_voucher_item: Annotated[Optional[List[CampaignsImportVoucherItem]], Field(description="Discount type, expiration date and the remaining attributes will be taken from the Campaign settings.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsImportCreateResponseBody: + """Import Vouchers to Campaign + + Imports vouchers to an **existing** campaign. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param campaigns_import_voucher_item: Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. + :type campaigns_import_voucher_item: List[CampaignsImportVoucherItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_to_campaign_serialize( + campaign_id=campaign_id, + campaigns_import_voucher_item=campaigns_import_voucher_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_vouchers_to_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + campaigns_import_voucher_item: Annotated[Optional[List[CampaignsImportVoucherItem]], Field(description="Discount type, expiration date and the remaining attributes will be taken from the Campaign settings.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsImportCreateResponseBody]: + """Import Vouchers to Campaign + + Imports vouchers to an **existing** campaign. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param campaigns_import_voucher_item: Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. + :type campaigns_import_voucher_item: List[CampaignsImportVoucherItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_to_campaign_serialize( + campaign_id=campaign_id, + campaigns_import_voucher_item=campaigns_import_voucher_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_vouchers_to_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + campaigns_import_voucher_item: Annotated[Optional[List[CampaignsImportVoucherItem]], Field(description="Discount type, expiration date and the remaining attributes will be taken from the Campaign settings.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import Vouchers to Campaign + + Imports vouchers to an **existing** campaign. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The ID of an existing campaign to which youre importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param campaigns_import_voucher_item: Discount type, expiration date and the remaining attributes will be taken from the Campaign settings. + :type campaigns_import_voucher_item: List[CampaignsImportVoucherItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_to_campaign_serialize( + campaign_id=campaign_id, + campaigns_import_voucher_item=campaigns_import_voucher_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_vouchers_to_campaign_serialize( + self, + campaign_id, + campaigns_import_voucher_item, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'CampaignsImportVoucherItem': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if campaigns_import_voucher_item is not None: + _body_params = campaigns_import_voucher_item + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/campaigns/{campaignId}/import', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_vouchers_to_campaign_using_csv( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value.")], + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsImportCsvCreateResponseBody: + """Import Vouchers to Campaign by CSV + + Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_to_campaign_using_csv_serialize( + campaign_id=campaign_id, + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_vouchers_to_campaign_using_csv_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value.")], + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsImportCsvCreateResponseBody]: + """Import Vouchers to Campaign by CSV + + Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_to_campaign_using_csv_serialize( + campaign_id=campaign_id, + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_vouchers_to_campaign_using_csv_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value.")], + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import Vouchers to Campaign by CSV + + Imports vouchers to an **existing** campaign. The CSV file has to include headers in the first line. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param campaign_id: The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_to_campaign_using_csv_serialize( + campaign_id=campaign_id, + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_vouchers_to_campaign_using_csv_serialize( + self, + campaign_id, + file, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + if file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/campaigns/{campaignId}/importCSV', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_campaigns( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + campaign_type: Annotated[Optional[ParameterCampaignType], Field(description="This attribute allows filtering by campaign type.")] = None, + expand: Annotated[Optional[ParameterExpandListCampaigns], Field(description="Include an expanded categories object in the response.")] = None, + order: Annotated[Optional[ParameterOrderListCampaigns], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsListResponseBody: + """List Campaigns + + Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param campaign_type: This attribute allows filtering by campaign type. + :type campaign_type: ParameterCampaignType + :param expand: Include an expanded categories object in the response. + :type expand: ParameterExpandListCampaigns + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCampaigns + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_campaigns_serialize( + limit=limit, + page=page, + campaign_type=campaign_type, + expand=expand, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_campaigns_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + campaign_type: Annotated[Optional[ParameterCampaignType], Field(description="This attribute allows filtering by campaign type.")] = None, + expand: Annotated[Optional[ParameterExpandListCampaigns], Field(description="Include an expanded categories object in the response.")] = None, + order: Annotated[Optional[ParameterOrderListCampaigns], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsListResponseBody]: + """List Campaigns + + Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param campaign_type: This attribute allows filtering by campaign type. + :type campaign_type: ParameterCampaignType + :param expand: Include an expanded categories object in the response. + :type expand: ParameterExpandListCampaigns + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCampaigns + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_campaigns_serialize( + limit=limit, + page=page, + campaign_type=campaign_type, + expand=expand, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_campaigns_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + campaign_type: Annotated[Optional[ParameterCampaignType], Field(description="This attribute allows filtering by campaign type.")] = None, + expand: Annotated[Optional[ParameterExpandListCampaigns], Field(description="Include an expanded categories object in the response.")] = None, + order: Annotated[Optional[ParameterOrderListCampaigns], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Campaigns + + Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param campaign_type: This attribute allows filtering by campaign type. + :type campaign_type: ParameterCampaignType + :param expand: Include an expanded categories object in the response. + :type expand: ParameterExpandListCampaigns + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCampaigns + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_campaigns_serialize( + limit=limit, + page=page, + campaign_type=campaign_type, + expand=expand, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_campaigns_serialize( + self, + limit, + page, + campaign_type, + expand, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if campaign_type is not None: + + _query_params.append(('campaign_type', campaign_type.value)) + + if expand is not None: + + _query_params.append(('expand', expand.value)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/campaigns', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + campaigns_update_request_body: Annotated[Optional[CampaignsUpdateRequestBody], Field(description="Specify the campaign parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CampaignsUpdateResponseBody: + """Update Campaign + + Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. ## Vouchers will be affected This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param campaigns_update_request_body: Specify the campaign parameters to be updated. + :type campaigns_update_request_body: CampaignsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_campaign_serialize( + campaign_id=campaign_id, + campaigns_update_request_body=campaigns_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + campaigns_update_request_body: Annotated[Optional[CampaignsUpdateRequestBody], Field(description="Specify the campaign parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CampaignsUpdateResponseBody]: + """Update Campaign + + Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. ## Vouchers will be affected This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param campaigns_update_request_body: Specify the campaign parameters to be updated. + :type campaigns_update_request_body: CampaignsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_campaign_serialize( + campaign_id=campaign_id, + campaigns_update_request_body=campaigns_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.")], + campaigns_update_request_body: Annotated[Optional[CampaignsUpdateRequestBody], Field(description="Specify the campaign parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Campaign + + Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. ## Vouchers will be affected This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet. + + :param campaign_id: You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value. (required) + :type campaign_id: str + :param campaigns_update_request_body: Specify the campaign parameters to be updated. + :type campaigns_update_request_body: CampaignsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_campaign_serialize( + campaign_id=campaign_id, + campaigns_update_request_body=campaigns_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CampaignsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_campaign_serialize( + self, + campaign_id, + campaigns_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if campaigns_update_request_body is not None: + _body_params = campaigns_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/campaigns/{campaignId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/categories_api.py b/voucherify/api/categories_api.py new file mode 100644 index 00000000..1e68708f --- /dev/null +++ b/voucherify/api/categories_api.py @@ -0,0 +1,1364 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.categories_create_request_body import CategoriesCreateRequestBody +from voucherify.models.categories_create_response_body import CategoriesCreateResponseBody +from voucherify.models.categories_get_response_body import CategoriesGetResponseBody +from voucherify.models.categories_list_response_body import CategoriesListResponseBody +from voucherify.models.categories_update_request_body import CategoriesUpdateRequestBody +from voucherify.models.categories_update_response_body import CategoriesUpdateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class CategoriesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_category( + self, + categories_create_request_body: Annotated[Optional[CategoriesCreateRequestBody], Field(description="Specify the details of the category that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CategoriesCreateResponseBody: + """Create Category + + Create category with a specific name and hierarchy. + + :param categories_create_request_body: Specify the details of the category that you would like to create. + :type categories_create_request_body: CategoriesCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_category_serialize( + categories_create_request_body=categories_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_category_with_http_info( + self, + categories_create_request_body: Annotated[Optional[CategoriesCreateRequestBody], Field(description="Specify the details of the category that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CategoriesCreateResponseBody]: + """Create Category + + Create category with a specific name and hierarchy. + + :param categories_create_request_body: Specify the details of the category that you would like to create. + :type categories_create_request_body: CategoriesCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_category_serialize( + categories_create_request_body=categories_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_category_without_preload_content( + self, + categories_create_request_body: Annotated[Optional[CategoriesCreateRequestBody], Field(description="Specify the details of the category that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Category + + Create category with a specific name and hierarchy. + + :param categories_create_request_body: Specify the details of the category that you would like to create. + :type categories_create_request_body: CategoriesCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_category_serialize( + categories_create_request_body=categories_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_category_serialize( + self, + categories_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if categories_create_request_body is not None: + _body_params = categories_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/categories', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_category( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Category + + Delete a category by the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_category_serialize( + category_id=category_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_category_with_http_info( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Category + + Delete a category by the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_category_serialize( + category_id=category_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_category_without_preload_content( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Category + + Delete a category by the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_category_serialize( + category_id=category_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_category_serialize( + self, + category_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if category_id is not None: + _path_params['categoryId'] = category_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/categories/{categoryId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_category( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CategoriesGetResponseBody: + """Get Category + + Retrieve a category by the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_category_serialize( + category_id=category_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_category_with_http_info( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CategoriesGetResponseBody]: + """Get Category + + Retrieve a category by the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_category_serialize( + category_id=category_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_category_without_preload_content( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Category + + Retrieve a category by the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_category_serialize( + category_id=category_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_category_serialize( + self, + category_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if category_id is not None: + _path_params['categoryId'] = category_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/categories/{categoryId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_categories( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CategoriesListResponseBody: + """List Categories + + List all categories. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_categories_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_categories_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CategoriesListResponseBody]: + """List Categories + + List all categories. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_categories_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_categories_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Categories + + List all categories. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_categories_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_categories_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/categories', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_category( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + categories_update_request_body: Annotated[Optional[CategoriesUpdateRequestBody], Field(description="Specify the details of the category that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CategoriesUpdateResponseBody: + """Update Category + + Update category using the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: str + :param categories_update_request_body: Specify the details of the category that you would like to update. + :type categories_update_request_body: CategoriesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_category_serialize( + category_id=category_id, + categories_update_request_body=categories_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_category_with_http_info( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + categories_update_request_body: Annotated[Optional[CategoriesUpdateRequestBody], Field(description="Specify the details of the category that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CategoriesUpdateResponseBody]: + """Update Category + + Update category using the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: str + :param categories_update_request_body: Specify the details of the category that you would like to update. + :type categories_update_request_body: CategoriesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_category_serialize( + category_id=category_id, + categories_update_request_body=categories_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_category_without_preload_content( + self, + category_id: Annotated[StrictStr, Field(description="Unique category ID assigned by Voucherify.")], + categories_update_request_body: Annotated[Optional[CategoriesUpdateRequestBody], Field(description="Specify the details of the category that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Category + + Update category using the category ID. + + :param category_id: Unique category ID assigned by Voucherify. (required) + :type category_id: str + :param categories_update_request_body: Specify the details of the category that you would like to update. + :type categories_update_request_body: CategoriesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_category_serialize( + category_id=category_id, + categories_update_request_body=categories_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CategoriesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_category_serialize( + self, + category_id, + categories_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if category_id is not None: + _path_params['categoryId'] = category_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if categories_update_request_body is not None: + _body_params = categories_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/categories/{categoryId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/client_side_api.py b/voucherify/api/client_side_api.py new file mode 100644 index 00000000..4bf6deb6 --- /dev/null +++ b/voucherify/api/client_side_api.py @@ -0,0 +1,1514 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.client_events_create_request_body import ClientEventsCreateRequestBody +from voucherify.models.client_events_create_response_body import ClientEventsCreateResponseBody +from voucherify.models.client_promotions_tiers_list_response_body import ClientPromotionsTiersListResponseBody +from voucherify.models.client_qualifications_check_eligibility_request_body import ClientQualificationsCheckEligibilityRequestBody +from voucherify.models.client_qualifications_check_eligibility_response_body import ClientQualificationsCheckEligibilityResponseBody +from voucherify.models.client_redemptions_redeem_request_body import ClientRedemptionsRedeemRequestBody +from voucherify.models.client_redemptions_redeem_response_body import ClientRedemptionsRedeemResponseBody +from voucherify.models.client_validations_validate_request_body import ClientValidationsValidateRequestBody +from voucherify.models.client_validations_validate_response_body import ClientValidationsValidateResponseBody +from voucherify.models.parameter_order_list_promotion_tiers_client_side import ParameterOrderListPromotionTiersClientSide + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class ClientSideApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def check_eligibility_client_side( + self, + client_qualifications_check_eligibility_request_body: Annotated[Optional[ClientQualificationsCheckEligibilityRequestBody], Field(description="Define order and customer context.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClientQualificationsCheckEligibilityResponseBody: + """Check Eligibility (client-side) + + Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + + :param client_qualifications_check_eligibility_request_body: Define order and customer context. + :type client_qualifications_check_eligibility_request_body: ClientQualificationsCheckEligibilityRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_eligibility_client_side_serialize( + client_qualifications_check_eligibility_request_body=client_qualifications_check_eligibility_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientQualificationsCheckEligibilityResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def check_eligibility_client_side_with_http_info( + self, + client_qualifications_check_eligibility_request_body: Annotated[Optional[ClientQualificationsCheckEligibilityRequestBody], Field(description="Define order and customer context.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClientQualificationsCheckEligibilityResponseBody]: + """Check Eligibility (client-side) + + Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + + :param client_qualifications_check_eligibility_request_body: Define order and customer context. + :type client_qualifications_check_eligibility_request_body: ClientQualificationsCheckEligibilityRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_eligibility_client_side_serialize( + client_qualifications_check_eligibility_request_body=client_qualifications_check_eligibility_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientQualificationsCheckEligibilityResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def check_eligibility_client_side_without_preload_content( + self, + client_qualifications_check_eligibility_request_body: Annotated[Optional[ClientQualificationsCheckEligibilityRequestBody], Field(description="Define order and customer context.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Check Eligibility (client-side) + + Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + + :param client_qualifications_check_eligibility_request_body: Define order and customer context. + :type client_qualifications_check_eligibility_request_body: ClientQualificationsCheckEligibilityRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_eligibility_client_side_serialize( + client_qualifications_check_eligibility_request_body=client_qualifications_check_eligibility_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientQualificationsCheckEligibilityResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _check_eligibility_client_side_serialize( + self, + client_qualifications_check_eligibility_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if client_qualifications_check_eligibility_request_body is not None: + _body_params = client_qualifications_check_eligibility_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-Client-Application-Id', + 'X-Client-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/client/v1/qualifications', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_promotion_tiers_client_side( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + is_available: Annotated[Optional[StrictBool], Field(description="This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPromotionTiersClientSide], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClientPromotionsTiersListResponseBody: + """List Promotion Tiers (client-side) + + This method enables you to list promotion tiers. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param is_available: This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + :type is_available: bool + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPromotionTiersClientSide + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_client_side_serialize( + origin=origin, + is_available=is_available, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientPromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_promotion_tiers_client_side_with_http_info( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + is_available: Annotated[Optional[StrictBool], Field(description="This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPromotionTiersClientSide], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClientPromotionsTiersListResponseBody]: + """List Promotion Tiers (client-side) + + This method enables you to list promotion tiers. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param is_available: This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + :type is_available: bool + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPromotionTiersClientSide + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_client_side_serialize( + origin=origin, + is_available=is_available, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientPromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_promotion_tiers_client_side_without_preload_content( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + is_available: Annotated[Optional[StrictBool], Field(description="This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPromotionTiersClientSide], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Promotion Tiers (client-side) + + This method enables you to list promotion tiers. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param is_available: This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + :type is_available: bool + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPromotionTiersClientSide + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_client_side_serialize( + origin=origin, + is_available=is_available, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientPromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_promotion_tiers_client_side_serialize( + self, + origin, + is_available, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if is_available is not None: + + _query_params.append(('is_available', is_available)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + if origin is not None: + _header_params['origin'] = origin + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-Client-Application-Id', + 'X-Client-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/client/v1/promotions/tiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def redeem_stacked_discounts_client_side( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_redemptions_redeem_request_body: Optional[ClientRedemptionsRedeemRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClientRedemptionsRedeemResponseBody: + """Redeem Stackable Discounts (client-side) + + This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_redemptions_redeem_request_body: + :type client_redemptions_redeem_request_body: ClientRedemptionsRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_stacked_discounts_client_side_serialize( + origin=origin, + client_redemptions_redeem_request_body=client_redemptions_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientRedemptionsRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def redeem_stacked_discounts_client_side_with_http_info( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_redemptions_redeem_request_body: Optional[ClientRedemptionsRedeemRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClientRedemptionsRedeemResponseBody]: + """Redeem Stackable Discounts (client-side) + + This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_redemptions_redeem_request_body: + :type client_redemptions_redeem_request_body: ClientRedemptionsRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_stacked_discounts_client_side_serialize( + origin=origin, + client_redemptions_redeem_request_body=client_redemptions_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientRedemptionsRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def redeem_stacked_discounts_client_side_without_preload_content( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_redemptions_redeem_request_body: Optional[ClientRedemptionsRedeemRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Redeem Stackable Discounts (client-side) + + This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_redemptions_redeem_request_body: + :type client_redemptions_redeem_request_body: ClientRedemptionsRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_stacked_discounts_client_side_serialize( + origin=origin, + client_redemptions_redeem_request_body=client_redemptions_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientRedemptionsRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _redeem_stacked_discounts_client_side_serialize( + self, + origin, + client_redemptions_redeem_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if origin is not None: + _header_params['origin'] = origin + # process the form parameters + # process the body parameter + if client_redemptions_redeem_request_body is not None: + _body_params = client_redemptions_redeem_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-Client-Application-Id', + 'X-Client-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/client/v1/redemptions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def track_custom_event_client_side( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_events_create_request_body: Annotated[Optional[ClientEventsCreateRequestBody], Field(description="Specify the details of the custom event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClientEventsCreateResponseBody: + """Track Custom Event (client-side) + + To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_events_create_request_body: Specify the details of the custom event. + :type client_events_create_request_body: ClientEventsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._track_custom_event_client_side_serialize( + origin=origin, + client_events_create_request_body=client_events_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientEventsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def track_custom_event_client_side_with_http_info( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_events_create_request_body: Annotated[Optional[ClientEventsCreateRequestBody], Field(description="Specify the details of the custom event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClientEventsCreateResponseBody]: + """Track Custom Event (client-side) + + To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_events_create_request_body: Specify the details of the custom event. + :type client_events_create_request_body: ClientEventsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._track_custom_event_client_side_serialize( + origin=origin, + client_events_create_request_body=client_events_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientEventsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def track_custom_event_client_side_without_preload_content( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_events_create_request_body: Annotated[Optional[ClientEventsCreateRequestBody], Field(description="Specify the details of the custom event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Track Custom Event (client-side) + + To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_events_create_request_body: Specify the details of the custom event. + :type client_events_create_request_body: ClientEventsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._track_custom_event_client_side_serialize( + origin=origin, + client_events_create_request_body=client_events_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientEventsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _track_custom_event_client_side_serialize( + self, + origin, + client_events_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if origin is not None: + _header_params['origin'] = origin + # process the form parameters + # process the body parameter + if client_events_create_request_body is not None: + _body_params = client_events_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-Client-Application-Id', + 'X-Client-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/client/v1/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def validate_stacked_discounts_client_side( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_validations_validate_request_body: Optional[ClientValidationsValidateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ClientValidationsValidateResponseBody: + """Validate Stackable Discounts (client-side) + + Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_validations_validate_request_body: + :type client_validations_validate_request_body: ClientValidationsValidateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._validate_stacked_discounts_client_side_serialize( + origin=origin, + client_validations_validate_request_body=client_validations_validate_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientValidationsValidateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def validate_stacked_discounts_client_side_with_http_info( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_validations_validate_request_body: Optional[ClientValidationsValidateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ClientValidationsValidateResponseBody]: + """Validate Stackable Discounts (client-side) + + Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_validations_validate_request_body: + :type client_validations_validate_request_body: ClientValidationsValidateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._validate_stacked_discounts_client_side_serialize( + origin=origin, + client_validations_validate_request_body=client_validations_validate_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientValidationsValidateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def validate_stacked_discounts_client_side_without_preload_content( + self, + origin: Annotated[StrictStr, Field(description="Indicates the origin (scheme, hostname, and port).")], + client_validations_validate_request_body: Optional[ClientValidationsValidateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Validate Stackable Discounts (client-side) + + Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. + + :param origin: Indicates the origin (scheme, hostname, and port). (required) + :type origin: str + :param client_validations_validate_request_body: + :type client_validations_validate_request_body: ClientValidationsValidateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._validate_stacked_discounts_client_side_serialize( + origin=origin, + client_validations_validate_request_body=client_validations_validate_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ClientValidationsValidateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _validate_stacked_discounts_client_side_serialize( + self, + origin, + client_validations_validate_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if origin is not None: + _header_params['origin'] = origin + # process the form parameters + # process the body parameter + if client_validations_validate_request_body is not None: + _body_params = client_validations_validate_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-Client-Application-Id', + 'X-Client-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/client/v1/validations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/customers_api.py b/voucherify/api/customers_api.py new file mode 100644 index 00000000..1880adac --- /dev/null +++ b/voucherify/api/customers_api.py @@ -0,0 +1,3728 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from datetime import datetime +from pydantic import Field, StrictBytes, StrictStr +from typing import List, Optional, Union +from typing_extensions import Annotated +from voucherify.models.customers_activity_list_response_body import CustomersActivityListResponseBody +from voucherify.models.customers_create_request_body import CustomersCreateRequestBody +from voucherify.models.customers_create_response_body import CustomersCreateResponseBody +from voucherify.models.customers_get_response_body import CustomersGetResponseBody +from voucherify.models.customers_import_csv_create_response_body import CustomersImportCsvCreateResponseBody +from voucherify.models.customers_list_response_body import CustomersListResponseBody +from voucherify.models.customers_metadata_update_in_bulk_request_body import CustomersMetadataUpdateInBulkRequestBody +from voucherify.models.customers_metadata_update_in_bulk_response_body import CustomersMetadataUpdateInBulkResponseBody +from voucherify.models.customers_permanent_deletion_create_response_body import CustomersPermanentDeletionCreateResponseBody +from voucherify.models.customers_redeemables_list_response_body import CustomersRedeemablesListResponseBody +from voucherify.models.customers_segments_list_response_body import CustomersSegmentsListResponseBody +from voucherify.models.customers_update_in_bulk_request_body import CustomersUpdateInBulkRequestBody +from voucherify.models.customers_update_in_bulk_response_body import CustomersUpdateInBulkResponseBody +from voucherify.models.customers_update_request_body import CustomersUpdateRequestBody +from voucherify.models.customers_update_response_body import CustomersUpdateResponseBody +from voucherify.models.parameter_activity_category import ParameterActivityCategory +from voucherify.models.parameter_campaign_type import ParameterCampaignType +from voucherify.models.parameter_filters_list_customer_redeemables import ParameterFiltersListCustomerRedeemables +from voucherify.models.parameter_order_created_at import ParameterOrderCreatedAt +from voucherify.models.parameter_order_list_customers import ParameterOrderListCustomers +from voucherify.models.parameter_order_list_redeemables import ParameterOrderListRedeemables + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class CustomersApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_customer( + self, + customers_create_request_body: Annotated[Optional[CustomersCreateRequestBody], Field(description="Create a customer with specified parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersCreateResponseBody: + """Create Customer + + Creates a customer object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields. + + :param customers_create_request_body: Create a customer with specified parameters. + :type customers_create_request_body: CustomersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_customer_serialize( + customers_create_request_body=customers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_customer_with_http_info( + self, + customers_create_request_body: Annotated[Optional[CustomersCreateRequestBody], Field(description="Create a customer with specified parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersCreateResponseBody]: + """Create Customer + + Creates a customer object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields. + + :param customers_create_request_body: Create a customer with specified parameters. + :type customers_create_request_body: CustomersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_customer_serialize( + customers_create_request_body=customers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_customer_without_preload_content( + self, + customers_create_request_body: Annotated[Optional[CustomersCreateRequestBody], Field(description="Create a customer with specified parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Customer + + Creates a customer object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the customer database, Voucherify will return a related customer object with updated fields. + + :param customers_create_request_body: Create a customer with specified parameters. + :type customers_create_request_body: CustomersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_customer_serialize( + customers_create_request_body=customers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_customer_serialize( + self, + customers_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if customers_create_request_body is not None: + _body_params = customers_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/customers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def customer_permanently_deletion( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersPermanentDeletionCreateResponseBody: + """Delete Customer Permanently + + The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._customer_permanently_deletion_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersPermanentDeletionCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def customer_permanently_deletion_with_http_info( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersPermanentDeletionCreateResponseBody]: + """Delete Customer Permanently + + The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._customer_permanently_deletion_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersPermanentDeletionCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def customer_permanently_deletion_without_preload_content( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Customer Permanently + + The organization user can remove consumer data permanently from the Voucherify system by using this API method. It deletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._customer_permanently_deletion_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersPermanentDeletionCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _customer_permanently_deletion_serialize( + self, + customer_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if customer_id is not None: + _path_params['customerId'] = customer_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/customers/{customerId}/permanent-deletion', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_customer( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Customer + + This method deletes a customer. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_customer_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_customer_with_http_info( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Customer + + This method deletes a customer. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_customer_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_customer_without_preload_content( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Customer + + This method deletes a customer. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_customer_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_customer_serialize( + self, + customer_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if customer_id is not None: + _path_params['customerId'] = customer_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/customers/{customerId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_customer( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersGetResponseBody: + """Get Customer + + Retrieve customer details. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_customer_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_customer_with_http_info( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersGetResponseBody]: + """Get Customer + + Retrieve customer details. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_customer_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_customer_without_preload_content( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Customer + + Retrieve customer details. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_customer_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_customer_serialize( + self, + customer_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if customer_id is not None: + _path_params['customerId'] = customer_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/customers/{customerId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_customers_using_csv( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersImportCsvCreateResponseBody: + """Import and Update Customers using CSV + + This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. ๐Ÿ“˜ Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_customers_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_customers_using_csv_with_http_info( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersImportCsvCreateResponseBody]: + """Import and Update Customers using CSV + + This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. ๐Ÿ“˜ Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_customers_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_customers_using_csv_without_preload_content( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import and Update Customers using CSV + + This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. # Request Example # CSV File Format The CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object. ๐Ÿ“˜ Standard customer fields mapping **No spaces allowed in field names** Id, Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2 # Update Customers using CSV If you would like to update customers data, you can do it using the CSV file with new data. However, remember to include a source_id in your CSV file to manage the update successfully. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_customers_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_customers_using_csv_serialize( + self, + file, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/customers/importCSV', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_customer_activity( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source ID of the customer who performed the activities.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. ")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + campaign_id: Annotated[Optional[StrictStr], Field(description="Requests only events related to specific campaign identified by its ID.")] = None, + campaign_type: Annotated[Optional[ParameterCampaignType], Field(description="Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM.")] = None, + category: Annotated[Optional[ParameterActivityCategory], Field(description="Filters activities for actions or effects. Allowed values: ACTION, EFFECT.")] = None, + type: Annotated[Optional[StrictStr], Field(description="Event name of the customer event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersActivityListResponseBody: + """List Customer Activity + + Retrieve customer activities. + + :param customer_id: A Voucherify customers id or source ID of the customer who performed the activities. (required) + :type customer_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: str + :param start_date: Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :param campaign_id: Requests only events related to specific campaign identified by its ID. + :type campaign_id: str + :param campaign_type: Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. + :type campaign_type: ParameterCampaignType + :param category: Filters activities for actions or effects. Allowed values: ACTION, EFFECT. + :type category: ParameterActivityCategory + :param type: Event name of the customer event. + :type type: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_activity_serialize( + customer_id=customer_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + start_date=start_date, + end_date=end_date, + campaign_id=campaign_id, + campaign_type=campaign_type, + category=category, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_customer_activity_with_http_info( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source ID of the customer who performed the activities.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. ")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + campaign_id: Annotated[Optional[StrictStr], Field(description="Requests only events related to specific campaign identified by its ID.")] = None, + campaign_type: Annotated[Optional[ParameterCampaignType], Field(description="Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM.")] = None, + category: Annotated[Optional[ParameterActivityCategory], Field(description="Filters activities for actions or effects. Allowed values: ACTION, EFFECT.")] = None, + type: Annotated[Optional[StrictStr], Field(description="Event name of the customer event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersActivityListResponseBody]: + """List Customer Activity + + Retrieve customer activities. + + :param customer_id: A Voucherify customers id or source ID of the customer who performed the activities. (required) + :type customer_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: str + :param start_date: Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :param campaign_id: Requests only events related to specific campaign identified by its ID. + :type campaign_id: str + :param campaign_type: Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. + :type campaign_type: ParameterCampaignType + :param category: Filters activities for actions or effects. Allowed values: ACTION, EFFECT. + :type category: ParameterActivityCategory + :param type: Event name of the customer event. + :type type: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_activity_serialize( + customer_id=customer_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + start_date=start_date, + end_date=end_date, + campaign_id=campaign_id, + campaign_type=campaign_type, + category=category, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_customer_activity_without_preload_content( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source ID of the customer who performed the activities.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. ")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + campaign_id: Annotated[Optional[StrictStr], Field(description="Requests only events related to specific campaign identified by its ID.")] = None, + campaign_type: Annotated[Optional[ParameterCampaignType], Field(description="Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM.")] = None, + category: Annotated[Optional[ParameterActivityCategory], Field(description="Filters activities for actions or effects. Allowed values: ACTION, EFFECT.")] = None, + type: Annotated[Optional[StrictStr], Field(description="Event name of the customer event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Customer Activity + + Retrieve customer activities. + + :param customer_id: A Voucherify customers id or source ID of the customer who performed the activities. (required) + :type customer_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: str + :param start_date: Timestamp representing the date and time which results must begin on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :param campaign_id: Requests only events related to specific campaign identified by its ID. + :type campaign_id: str + :param campaign_type: Filters related customers activity for the selected campaign types. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM. + :type campaign_type: ParameterCampaignType + :param category: Filters activities for actions or effects. Allowed values: ACTION, EFFECT. + :type category: ParameterActivityCategory + :param type: Event name of the customer event. + :type type: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_activity_serialize( + customer_id=customer_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + start_date=start_date, + end_date=end_date, + campaign_id=campaign_id, + campaign_type=campaign_type, + category=category, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_customer_activity_serialize( + self, + customer_id, + limit, + order, + starting_after_id, + start_date, + end_date, + campaign_id, + campaign_type, + category, + type, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if customer_id is not None: + _path_params['customerId'] = customer_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after_id is not None: + + _query_params.append(('starting_after_id', starting_after_id)) + + if start_date is not None: + if isinstance(start_date, datetime): + _query_params.append( + ( + 'start_date', + start_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('start_date', start_date)) + + if end_date is not None: + if isinstance(end_date, datetime): + _query_params.append( + ( + 'end_date', + end_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('end_date', end_date)) + + if campaign_id is not None: + + _query_params.append(('campaign_id', campaign_id)) + + if campaign_type is not None: + + _query_params.append(('campaign_type', campaign_type.value)) + + if category is not None: + + _query_params.append(('category', category.value)) + + if type is not None: + + _query_params.append(('type', type)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/customers/{customerId}/activity', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_customer_redeemables( + self, + customer_id: Annotated[StrictStr, Field(description="Unique identifier of a customer represented by an internal customer ID or customer source ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListRedeemables], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + filters: Annotated[Optional[ParameterFiltersListCustomerRedeemables], Field(description="Filters for listing customer redeemables.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersRedeemablesListResponseBody: + """List Customer's Redeemables + + Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + + :param customer_id: Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + :type customer_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListRedeemables + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: str + :param filters: Filters for listing customer redeemables. + :type filters: ParameterFiltersListCustomerRedeemables + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_redeemables_serialize( + customer_id=customer_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + filters=filters, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersRedeemablesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_customer_redeemables_with_http_info( + self, + customer_id: Annotated[StrictStr, Field(description="Unique identifier of a customer represented by an internal customer ID or customer source ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListRedeemables], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + filters: Annotated[Optional[ParameterFiltersListCustomerRedeemables], Field(description="Filters for listing customer redeemables.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersRedeemablesListResponseBody]: + """List Customer's Redeemables + + Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + + :param customer_id: Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + :type customer_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListRedeemables + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: str + :param filters: Filters for listing customer redeemables. + :type filters: ParameterFiltersListCustomerRedeemables + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_redeemables_serialize( + customer_id=customer_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + filters=filters, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersRedeemablesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_customer_redeemables_without_preload_content( + self, + customer_id: Annotated[StrictStr, Field(description="Unique identifier of a customer represented by an internal customer ID or customer source ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListRedeemables], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + filters: Annotated[Optional[ParameterFiltersListCustomerRedeemables], Field(description="Filters for listing customer redeemables.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Customer's Redeemables + + Retrieves all the redeemables that have been assigned to the customer. To use this endpoint, you must have the following permissions: - Read Customers (customers.details.read) + + :param customer_id: Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + :type customer_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListRedeemables + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: str + :param filters: Filters for listing customer redeemables. + :type filters: ParameterFiltersListCustomerRedeemables + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_redeemables_serialize( + customer_id=customer_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + filters=filters, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersRedeemablesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_customer_redeemables_serialize( + self, + customer_id, + limit, + order, + starting_after_id, + filters, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if customer_id is not None: + _path_params['customerId'] = customer_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after_id is not None: + + _query_params.append(('starting_after_id', starting_after_id)) + + if filters is not None: + + _query_params.append(('filters', filters)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/customers/{customerId}/redeemables', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_customer_segments( + self, + customer_id: Annotated[StrictStr, Field(description="Unique identifier of a customer represented by an internal customer ID or customer source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersSegmentsListResponseBody: + """List Customer's Segments + + Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. + + :param customer_id: Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_segments_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersSegmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_customer_segments_with_http_info( + self, + customer_id: Annotated[StrictStr, Field(description="Unique identifier of a customer represented by an internal customer ID or customer source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersSegmentsListResponseBody]: + """List Customer's Segments + + Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. + + :param customer_id: Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_segments_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersSegmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_customer_segments_without_preload_content( + self, + customer_id: Annotated[StrictStr, Field(description="Unique identifier of a customer represented by an internal customer ID or customer source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Customer's Segments + + Returns the list of segments IDs to which the customer belongs to. If you pass a customerId which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system. + + :param customer_id: Unique identifier of a customer represented by an internal customer ID or customer source ID. (required) + :type customer_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customer_segments_serialize( + customer_id=customer_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersSegmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_customer_segments_serialize( + self, + customer_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if customer_id is not None: + _path_params['customerId'] = customer_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/customers/{customerId}/segments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_customers( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + email: Annotated[Optional[StrictStr], Field(description="Limit the customers to the ones that have this specific email address.")] = None, + city: Annotated[Optional[StrictStr], Field(description="Limit the customers to the ones that are located in the specified city.")] = None, + name: Annotated[Optional[StrictStr], Field(description="Filter customers by the name property.")] = None, + segment_id: Annotated[Optional[StrictStr], Field(description="Filter customers by the segment id.")] = None, + created_at_before: Annotated[Optional[datetime], Field(description="Filter customers by date customer was created.")] = None, + created_at_after: Annotated[Optional[datetime], Field(description="Filter customers by date customer was created.")] = None, + updated_at_before: Annotated[Optional[datetime], Field(description="Filter customers by date customer was updated last time.")] = None, + updated_at_after: Annotated[Optional[datetime], Field(description="Filter customers by date customer was updated last time.")] = None, + order: Annotated[Optional[ParameterOrderListCustomers], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after: Annotated[Optional[datetime], Field(description="A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersListResponseBody: + """List Customers + + Returns a list of customers. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param email: Limit the customers to the ones that have this specific email address. + :type email: str + :param city: Limit the customers to the ones that are located in the specified city. + :type city: str + :param name: Filter customers by the name property. + :type name: str + :param segment_id: Filter customers by the segment id. + :type segment_id: str + :param created_at_before: Filter customers by date customer was created. + :type created_at_before: datetime + :param created_at_after: Filter customers by date customer was created. + :type created_at_after: datetime + :param updated_at_before: Filter customers by date customer was updated last time. + :type updated_at_before: datetime + :param updated_at_after: Filter customers by date customer was updated last time. + :type updated_at_after: datetime + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCustomers + :param starting_after: A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + :type starting_after: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customers_serialize( + limit=limit, + page=page, + email=email, + city=city, + name=name, + segment_id=segment_id, + created_at_before=created_at_before, + created_at_after=created_at_after, + updated_at_before=updated_at_before, + updated_at_after=updated_at_after, + order=order, + starting_after=starting_after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_customers_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + email: Annotated[Optional[StrictStr], Field(description="Limit the customers to the ones that have this specific email address.")] = None, + city: Annotated[Optional[StrictStr], Field(description="Limit the customers to the ones that are located in the specified city.")] = None, + name: Annotated[Optional[StrictStr], Field(description="Filter customers by the name property.")] = None, + segment_id: Annotated[Optional[StrictStr], Field(description="Filter customers by the segment id.")] = None, + created_at_before: Annotated[Optional[datetime], Field(description="Filter customers by date customer was created.")] = None, + created_at_after: Annotated[Optional[datetime], Field(description="Filter customers by date customer was created.")] = None, + updated_at_before: Annotated[Optional[datetime], Field(description="Filter customers by date customer was updated last time.")] = None, + updated_at_after: Annotated[Optional[datetime], Field(description="Filter customers by date customer was updated last time.")] = None, + order: Annotated[Optional[ParameterOrderListCustomers], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after: Annotated[Optional[datetime], Field(description="A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersListResponseBody]: + """List Customers + + Returns a list of customers. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param email: Limit the customers to the ones that have this specific email address. + :type email: str + :param city: Limit the customers to the ones that are located in the specified city. + :type city: str + :param name: Filter customers by the name property. + :type name: str + :param segment_id: Filter customers by the segment id. + :type segment_id: str + :param created_at_before: Filter customers by date customer was created. + :type created_at_before: datetime + :param created_at_after: Filter customers by date customer was created. + :type created_at_after: datetime + :param updated_at_before: Filter customers by date customer was updated last time. + :type updated_at_before: datetime + :param updated_at_after: Filter customers by date customer was updated last time. + :type updated_at_after: datetime + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCustomers + :param starting_after: A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + :type starting_after: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customers_serialize( + limit=limit, + page=page, + email=email, + city=city, + name=name, + segment_id=segment_id, + created_at_before=created_at_before, + created_at_after=created_at_after, + updated_at_before=updated_at_before, + updated_at_after=updated_at_after, + order=order, + starting_after=starting_after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_customers_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + email: Annotated[Optional[StrictStr], Field(description="Limit the customers to the ones that have this specific email address.")] = None, + city: Annotated[Optional[StrictStr], Field(description="Limit the customers to the ones that are located in the specified city.")] = None, + name: Annotated[Optional[StrictStr], Field(description="Filter customers by the name property.")] = None, + segment_id: Annotated[Optional[StrictStr], Field(description="Filter customers by the segment id.")] = None, + created_at_before: Annotated[Optional[datetime], Field(description="Filter customers by date customer was created.")] = None, + created_at_after: Annotated[Optional[datetime], Field(description="Filter customers by date customer was created.")] = None, + updated_at_before: Annotated[Optional[datetime], Field(description="Filter customers by date customer was updated last time.")] = None, + updated_at_after: Annotated[Optional[datetime], Field(description="Filter customers by date customer was updated last time.")] = None, + order: Annotated[Optional[ParameterOrderListCustomers], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after: Annotated[Optional[datetime], Field(description="A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Customers + + Returns a list of customers. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param email: Limit the customers to the ones that have this specific email address. + :type email: str + :param city: Limit the customers to the ones that are located in the specified city. + :type city: str + :param name: Filter customers by the name property. + :type name: str + :param segment_id: Filter customers by the segment id. + :type segment_id: str + :param created_at_before: Filter customers by date customer was created. + :type created_at_before: datetime + :param created_at_after: Filter customers by date customer was created. + :type created_at_after: datetime + :param updated_at_before: Filter customers by date customer was updated last time. + :type updated_at_before: datetime + :param updated_at_after: Filter customers by date customer was updated last time. + :type updated_at_after: datetime + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCustomers + :param starting_after: A cursor for pagination. This is a date-time value that defines your place in the list based on created_at property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. + :type starting_after: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_customers_serialize( + limit=limit, + page=page, + email=email, + city=city, + name=name, + segment_id=segment_id, + created_at_before=created_at_before, + created_at_after=created_at_after, + updated_at_before=updated_at_before, + updated_at_after=updated_at_after, + order=order, + starting_after=starting_after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_customers_serialize( + self, + limit, + page, + email, + city, + name, + segment_id, + created_at_before, + created_at_after, + updated_at_before, + updated_at_after, + order, + starting_after, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if email is not None: + + _query_params.append(('email', email)) + + if city is not None: + + _query_params.append(('city', city)) + + if name is not None: + + _query_params.append(('name', name)) + + if segment_id is not None: + + _query_params.append(('segment_id', segment_id)) + + if created_at_before is not None: + if isinstance(created_at_before, datetime): + _query_params.append( + ( + 'created_at[before]', + created_at_before.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('created_at[before]', created_at_before)) + + if created_at_after is not None: + if isinstance(created_at_after, datetime): + _query_params.append( + ( + 'created_at[after]', + created_at_after.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('created_at[after]', created_at_after)) + + if updated_at_before is not None: + if isinstance(updated_at_before, datetime): + _query_params.append( + ( + 'updated_at[before]', + updated_at_before.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('updated_at[before]', updated_at_before)) + + if updated_at_after is not None: + if isinstance(updated_at_after, datetime): + _query_params.append( + ( + 'updated_at[after]', + updated_at_after.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('updated_at[after]', updated_at_after)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after is not None: + if isinstance(starting_after, datetime): + _query_params.append( + ( + 'starting_after', + starting_after.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('starting_after', starting_after)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/customers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_customer( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + customers_update_request_body: Annotated[Optional[CustomersUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersUpdateResponseBody: + """Update Customer + + Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: str + :param customers_update_request_body: Specify the parameters to be updated. + :type customers_update_request_body: CustomersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customer_serialize( + customer_id=customer_id, + customers_update_request_body=customers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_customer_with_http_info( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + customers_update_request_body: Annotated[Optional[CustomersUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersUpdateResponseBody]: + """Update Customer + + Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: str + :param customers_update_request_body: Specify the parameters to be updated. + :type customers_update_request_body: CustomersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customer_serialize( + customer_id=customer_id, + customers_update_request_body=customers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_customer_without_preload_content( + self, + customer_id: Annotated[StrictStr, Field(description="A Voucherify customers id or source_id.")], + customers_update_request_body: Annotated[Optional[CustomersUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Customer + + Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + + :param customer_id: A Voucherify customers id or source_id. (required) + :type customer_id: str + :param customers_update_request_body: Specify the parameters to be updated. + :type customers_update_request_body: CustomersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customer_serialize( + customer_id=customer_id, + customers_update_request_body=customers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_customer_serialize( + self, + customer_id, + customers_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if customer_id is not None: + _path_params['customerId'] = customer_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if customers_update_request_body is not None: + _body_params = customers_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/customers/{customerId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_customers_in_bulk( + self, + customers_update_in_bulk_request_body: Annotated[Optional[List[CustomersUpdateInBulkRequestBody]], Field(description="List the customer fields to be updated in each customer object.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersUpdateInBulkResponseBody: + """Update Customers in Bulk + + Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param customers_update_in_bulk_request_body: List the customer fields to be updated in each customer object. + :type customers_update_in_bulk_request_body: List[CustomersUpdateInBulkRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customers_in_bulk_serialize( + customers_update_in_bulk_request_body=customers_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_customers_in_bulk_with_http_info( + self, + customers_update_in_bulk_request_body: Annotated[Optional[List[CustomersUpdateInBulkRequestBody]], Field(description="List the customer fields to be updated in each customer object.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersUpdateInBulkResponseBody]: + """Update Customers in Bulk + + Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param customers_update_in_bulk_request_body: List the customer fields to be updated in each customer object. + :type customers_update_in_bulk_request_body: List[CustomersUpdateInBulkRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customers_in_bulk_serialize( + customers_update_in_bulk_request_body=customers_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_customers_in_bulk_without_preload_content( + self, + customers_update_in_bulk_request_body: Annotated[Optional[List[CustomersUpdateInBulkRequestBody]], Field(description="List the customer fields to be updated in each customer object.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Customers in Bulk + + Updates customers in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a customer object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param customers_update_in_bulk_request_body: List the customer fields to be updated in each customer object. + :type customers_update_in_bulk_request_body: List[CustomersUpdateInBulkRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customers_in_bulk_serialize( + customers_update_in_bulk_request_body=customers_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_customers_in_bulk_serialize( + self, + customers_update_in_bulk_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'CustomersUpdateInBulkRequestBody': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if customers_update_in_bulk_request_body is not None: + _body_params = customers_update_in_bulk_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/customers/bulk/async', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_customers_metadata_in_bulk( + self, + customers_metadata_update_in_bulk_request_body: Annotated[Optional[CustomersMetadataUpdateInBulkRequestBody], Field(description="List the source_ids of the customers you would like to update with the metadata key/value pairs.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomersMetadataUpdateInBulkResponseBody: + """Update Customers' Metadata in Bulk + + Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param customers_metadata_update_in_bulk_request_body: List the source_ids of the customers you would like to update with the metadata key/value pairs. + :type customers_metadata_update_in_bulk_request_body: CustomersMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customers_metadata_in_bulk_serialize( + customers_metadata_update_in_bulk_request_body=customers_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_customers_metadata_in_bulk_with_http_info( + self, + customers_metadata_update_in_bulk_request_body: Annotated[Optional[CustomersMetadataUpdateInBulkRequestBody], Field(description="List the source_ids of the customers you would like to update with the metadata key/value pairs.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomersMetadataUpdateInBulkResponseBody]: + """Update Customers' Metadata in Bulk + + Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param customers_metadata_update_in_bulk_request_body: List the source_ids of the customers you would like to update with the metadata key/value pairs. + :type customers_metadata_update_in_bulk_request_body: CustomersMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customers_metadata_in_bulk_serialize( + customers_metadata_update_in_bulk_request_body=customers_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_customers_metadata_in_bulk_without_preload_content( + self, + customers_metadata_update_in_bulk_request_body: Annotated[Optional[CustomersMetadataUpdateInBulkRequestBody], Field(description="List the source_ids of the customers you would like to update with the metadata key/value pairs.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Customers' Metadata in Bulk + + Updates metadata parameters for a list of customers. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param customers_metadata_update_in_bulk_request_body: List the source_ids of the customers you would like to update with the metadata key/value pairs. + :type customers_metadata_update_in_bulk_request_body: CustomersMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_customers_metadata_in_bulk_serialize( + customers_metadata_update_in_bulk_request_body=customers_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "CustomersMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_customers_metadata_in_bulk_serialize( + self, + customers_metadata_update_in_bulk_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if customers_metadata_update_in_bulk_request_body is not None: + _body_params = customers_metadata_update_in_bulk_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/customers/metadata/async', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/events_api.py b/voucherify/api/events_api.py new file mode 100644 index 00000000..c7ccd494 --- /dev/null +++ b/voucherify/api/events_api.py @@ -0,0 +1,314 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.events_create_request_body import EventsCreateRequestBody +from voucherify.models.events_create_response_body import EventsCreateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class EventsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def track_custom_event( + self, + events_create_request_body: Annotated[Optional[EventsCreateRequestBody], Field(description="Specify the details of the custom event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EventsCreateResponseBody: + """Track Custom Event + + To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + + :param events_create_request_body: Specify the details of the custom event. + :type events_create_request_body: EventsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._track_custom_event_serialize( + events_create_request_body=events_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "EventsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def track_custom_event_with_http_info( + self, + events_create_request_body: Annotated[Optional[EventsCreateRequestBody], Field(description="Specify the details of the custom event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EventsCreateResponseBody]: + """Track Custom Event + + To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + + :param events_create_request_body: Specify the details of the custom event. + :type events_create_request_body: EventsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._track_custom_event_serialize( + events_create_request_body=events_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "EventsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def track_custom_event_without_preload_content( + self, + events_create_request_body: Annotated[Optional[EventsCreateRequestBody], Field(description="Specify the details of the custom event.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Track Custom Event + + To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created. + + :param events_create_request_body: Specify the details of the custom event. + :type events_create_request_body: EventsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._track_custom_event_serialize( + events_create_request_body=events_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "EventsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _track_custom_event_serialize( + self, + events_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if events_create_request_body is not None: + _body_params = events_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/events', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/exports_api.py b/voucherify/api/exports_api.py new file mode 100644 index 00000000..0ba32251 --- /dev/null +++ b/voucherify/api/exports_api.py @@ -0,0 +1,1401 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.exports_create_request_body import ExportsCreateRequestBody +from voucherify.models.exports_create_response_body import ExportsCreateResponseBody +from voucherify.models.exports_get_response_body import ExportsGetResponseBody +from voucherify.models.exports_list_response_body import ExportsListResponseBody +from voucherify.models.parameter_order_list_exports import ParameterOrderListExports + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class ExportsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_export( + self, + exports_create_request_body: Annotated[Optional[ExportsCreateRequestBody], Field(description="Specify the details of the export that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ExportsCreateResponseBody: + """Create Export + + Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions + + :param exports_create_request_body: Specify the details of the export that you would like to create. + :type exports_create_request_body: ExportsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_serialize( + exports_create_request_body=exports_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_export_with_http_info( + self, + exports_create_request_body: Annotated[Optional[ExportsCreateRequestBody], Field(description="Specify the details of the export that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ExportsCreateResponseBody]: + """Create Export + + Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions + + :param exports_create_request_body: Specify the details of the export that you would like to create. + :type exports_create_request_body: ExportsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_serialize( + exports_create_request_body=exports_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_export_without_preload_content( + self, + exports_create_request_body: Annotated[Optional[ExportsCreateRequestBody], Field(description="Specify the details of the export that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Export + + Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions + + :param exports_create_request_body: Specify the details of the export that you would like to create. + :type exports_create_request_body: ExportsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_export_serialize( + exports_create_request_body=exports_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_export_serialize( + self, + exports_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if exports_create_request_body is not None: + _body_params = exports_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/exports', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_export( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Export + + This method deletes a previously created export object. + + :param export_id: Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + :type export_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_export_serialize( + export_id=export_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_export_with_http_info( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Export + + This method deletes a previously created export object. + + :param export_id: Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + :type export_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_export_serialize( + export_id=export_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_export_without_preload_content( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Export + + This method deletes a previously created export object. + + :param export_id: Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + :type export_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_export_serialize( + export_id=export_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_export_serialize( + self, + export_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if export_id is not None: + _path_params['exportId'] = export_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/exports/{exportId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def download_export( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID.")], + token: Annotated[Optional[StrictStr], Field(description="Token that was issued to the export, to get this token, get the export first")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> str: + """Download Export + + Download the contents of the exported CSV file. ๐Ÿ“˜ Important notes **Base URL:** - https://download.voucherify.io (Europe) - https://us1.download.voucherify.io (US) - https://as1.download.voucherify.io (Asia) **Token:** Can be found within the result parameter of the Get Export method response. + + :param export_id: Unique export object ID. (required) + :type export_id: str + :param token: Token that was issued to the export, to get this token, get the export first + :type token: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_export_serialize( + export_id=export_id, + token=token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def download_export_with_http_info( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID.")], + token: Annotated[Optional[StrictStr], Field(description="Token that was issued to the export, to get this token, get the export first")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[str]: + """Download Export + + Download the contents of the exported CSV file. ๐Ÿ“˜ Important notes **Base URL:** - https://download.voucherify.io (Europe) - https://us1.download.voucherify.io (US) - https://as1.download.voucherify.io (Asia) **Token:** Can be found within the result parameter of the Get Export method response. + + :param export_id: Unique export object ID. (required) + :type export_id: str + :param token: Token that was issued to the export, to get this token, get the export first + :type token: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_export_serialize( + export_id=export_id, + token=token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def download_export_without_preload_content( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID.")], + token: Annotated[Optional[StrictStr], Field(description="Token that was issued to the export, to get this token, get the export first")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Download Export + + Download the contents of the exported CSV file. ๐Ÿ“˜ Important notes **Base URL:** - https://download.voucherify.io (Europe) - https://us1.download.voucherify.io (US) - https://as1.download.voucherify.io (Asia) **Token:** Can be found within the result parameter of the Get Export method response. + + :param export_id: Unique export object ID. (required) + :type export_id: str + :param token: Token that was issued to the export, to get this token, get the export first + :type token: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_export_serialize( + export_id=export_id, + token=token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _download_export_serialize( + self, + export_id, + token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if export_id is not None: + _path_params['export_Id'] = export_id + # process the query parameters + if token is not None: + + _query_params.append(('token', token)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/exports/{export_Id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_export( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ExportsGetResponseBody: + """Get Export + + Retrieves the URL of the downloadable file, which was generated via the Create Export method. + + :param export_id: Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + :type export_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_export_serialize( + export_id=export_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_export_with_http_info( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ExportsGetResponseBody]: + """Get Export + + Retrieves the URL of the downloadable file, which was generated via the Create Export method. + + :param export_id: Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + :type export_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_export_serialize( + export_id=export_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_export_without_preload_content( + self, + export_id: Annotated[StrictStr, Field(description="Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Export + + Retrieves the URL of the downloadable file, which was generated via the Create Export method. + + :param export_id: Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. (required) + :type export_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_export_serialize( + export_id=export_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_export_serialize( + self, + export_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if export_id is not None: + _path_params['exportId'] = export_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/exports/{exportId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_exports( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListExports], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ExportsListResponseBody: + """List Exports + + List all exports. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListExports + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_exports_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_exports_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListExports], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ExportsListResponseBody]: + """List Exports + + List all exports. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListExports + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_exports_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_exports_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListExports], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Exports + + List all exports. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListExports + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_exports_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ExportsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_exports_serialize( + self, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/exports', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/loyalties_api.py b/voucherify/api/loyalties_api.py new file mode 100644 index 00000000..871f4d98 --- /dev/null +++ b/voucherify/api/loyalties_api.py @@ -0,0 +1,12940 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from voucherify.models.loyalties_create_campaign_request_body import LoyaltiesCreateCampaignRequestBody +from voucherify.models.loyalties_create_campaign_response_body import LoyaltiesCreateCampaignResponseBody +from voucherify.models.loyalties_delete_response_body import LoyaltiesDeleteResponseBody +from voucherify.models.loyalties_earning_rules_create_request_body_item import LoyaltiesEarningRulesCreateRequestBodyItem +from voucherify.models.loyalties_earning_rules_create_response_body import LoyaltiesEarningRulesCreateResponseBody +from voucherify.models.loyalties_earning_rules_disable_response_body import LoyaltiesEarningRulesDisableResponseBody +from voucherify.models.loyalties_earning_rules_enable_response_body import LoyaltiesEarningRulesEnableResponseBody +from voucherify.models.loyalties_earning_rules_get_response_body import LoyaltiesEarningRulesGetResponseBody +from voucherify.models.loyalties_earning_rules_list_response_body import LoyaltiesEarningRulesListResponseBody +from voucherify.models.loyalties_earning_rules_update_request_body import LoyaltiesEarningRulesUpdateRequestBody +from voucherify.models.loyalties_earning_rules_update_response_body import LoyaltiesEarningRulesUpdateResponseBody +from voucherify.models.loyalties_get_campaign_response_body import LoyaltiesGetCampaignResponseBody +from voucherify.models.loyalties_list_campaigns_response_body import LoyaltiesListCampaignsResponseBody +from voucherify.models.loyalties_list_members_response_body import LoyaltiesListMembersResponseBody +from voucherify.models.loyalties_member_activity_list_response_body import LoyaltiesMemberActivityListResponseBody +from voucherify.models.loyalties_members_balance_update_request_body import LoyaltiesMembersBalanceUpdateRequestBody +from voucherify.models.loyalties_members_balance_update_response_body import LoyaltiesMembersBalanceUpdateResponseBody +from voucherify.models.loyalties_members_create_request_body import LoyaltiesMembersCreateRequestBody +from voucherify.models.loyalties_members_create_response_body import LoyaltiesMembersCreateResponseBody +from voucherify.models.loyalties_members_get_response_body import LoyaltiesMembersGetResponseBody +from voucherify.models.loyalties_members_points_expiration_list_response_body import LoyaltiesMembersPointsExpirationListResponseBody +from voucherify.models.loyalties_members_redemption_redeem_request_body import LoyaltiesMembersRedemptionRedeemRequestBody +from voucherify.models.loyalties_members_redemption_redeem_response_body import LoyaltiesMembersRedemptionRedeemResponseBody +from voucherify.models.loyalties_members_rewards_list_response_body import LoyaltiesMembersRewardsListResponseBody +from voucherify.models.loyalties_members_tiers_list_response_body import LoyaltiesMembersTiersListResponseBody +from voucherify.models.loyalties_members_transactions_export_create_request_body import LoyaltiesMembersTransactionsExportCreateRequestBody +from voucherify.models.loyalties_members_transactions_export_create_response_body import LoyaltiesMembersTransactionsExportCreateResponseBody +from voucherify.models.loyalties_members_transactions_list_response_body import LoyaltiesMembersTransactionsListResponseBody +from voucherify.models.loyalties_members_transfers_create_response_body import LoyaltiesMembersTransfersCreateResponseBody +from voucherify.models.loyalties_points_expiration_export_create_request_body import LoyaltiesPointsExpirationExportCreateRequestBody +from voucherify.models.loyalties_points_expiration_export_create_response_body import LoyaltiesPointsExpirationExportCreateResponseBody +from voucherify.models.loyalties_reward_assignments_get_response_body import LoyaltiesRewardAssignmentsGetResponseBody +from voucherify.models.loyalties_reward_assignments_list_response_body import LoyaltiesRewardAssignmentsListResponseBody +from voucherify.models.loyalties_reward_assignments_reward_get_response_body import LoyaltiesRewardAssignmentsRewardGetResponseBody +from voucherify.models.loyalties_rewards_create_assignment_item_request_body import LoyaltiesRewardsCreateAssignmentItemRequestBody +from voucherify.models.loyalties_rewards_create_assignment_response_body import LoyaltiesRewardsCreateAssignmentResponseBody +from voucherify.models.loyalties_rewards_get_response_body import LoyaltiesRewardsGetResponseBody +from voucherify.models.loyalties_rewards_list_assignments_response_body import LoyaltiesRewardsListAssignmentsResponseBody +from voucherify.models.loyalties_rewards_update_assignment_request_body import LoyaltiesRewardsUpdateAssignmentRequestBody +from voucherify.models.loyalties_rewards_update_assignment_response_body import LoyaltiesRewardsUpdateAssignmentResponseBody +from voucherify.models.loyalties_tiers_create_in_bulk_request_body_item import LoyaltiesTiersCreateInBulkRequestBodyItem +from voucherify.models.loyalties_tiers_earning_rules_list_response_body import LoyaltiesTiersEarningRulesListResponseBody +from voucherify.models.loyalties_tiers_get_response_body import LoyaltiesTiersGetResponseBody +from voucherify.models.loyalties_tiers_list_response_body import LoyaltiesTiersListResponseBody +from voucherify.models.loyalties_tiers_rewards_list_response_body import LoyaltiesTiersRewardsListResponseBody +from voucherify.models.loyalties_transfer_points import LoyaltiesTransferPoints +from voucherify.models.loyalties_update_campaign_request_body import LoyaltiesUpdateCampaignRequestBody +from voucherify.models.loyalties_update_campaign_response_body import LoyaltiesUpdateCampaignResponseBody +from voucherify.models.loyalty_tier import LoyaltyTier +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_order_created_at import ParameterOrderCreatedAt +from voucherify.models.parameter_order_list_campaigns import ParameterOrderListCampaigns +from voucherify.models.parameter_order_list_earning_rules import ParameterOrderListEarningRules +from voucherify.models.parameter_order_list_loyalty_tiers import ParameterOrderListLoyaltyTiers +from voucherify.models.parameter_order_list_transactions import ParameterOrderListTransactions +from voucherify.models.parameter_order_vouchers import ParameterOrderVouchers +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class LoyaltiesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def add_member( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID of the loyalty program.")], + loyalties_members_create_request_body: Annotated[Optional[LoyaltiesMembersCreateRequestBody], Field(description="Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersCreateResponseBody: + """Add Member + + This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + + :param campaign_id: Unique campaign ID of the loyalty program. (required) + :type campaign_id: str + :param loyalties_members_create_request_body: Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. + :type loyalties_members_create_request_body: LoyaltiesMembersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_member_serialize( + campaign_id=campaign_id, + loyalties_members_create_request_body=loyalties_members_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_member_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID of the loyalty program.")], + loyalties_members_create_request_body: Annotated[Optional[LoyaltiesMembersCreateRequestBody], Field(description="Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersCreateResponseBody]: + """Add Member + + This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + + :param campaign_id: Unique campaign ID of the loyalty program. (required) + :type campaign_id: str + :param loyalties_members_create_request_body: Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. + :type loyalties_members_create_request_body: LoyaltiesMembersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_member_serialize( + campaign_id=campaign_id, + loyalties_members_create_request_body=loyalties_members_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_member_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID of the loyalty program.")], + loyalties_members_create_request_body: Annotated[Optional[LoyaltiesMembersCreateRequestBody], Field(description="Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add Member + + This method assigns a loyalty card to a customer. It selects a loyalty card suitable for publication, adds a publish entry, and returns the published voucher. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign. + + :param campaign_id: Unique campaign ID of the loyalty program. (required) + :type campaign_id: str + :param loyalties_members_create_request_body: Provide details to whom the loyalty card should be assigned. You can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. You can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the List Publications endpoint. + :type loyalties_members_create_request_body: LoyaltiesMembersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_member_serialize( + campaign_id=campaign_id, + loyalties_members_create_request_body=loyalties_members_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_member_serialize( + self, + campaign_id, + loyalties_members_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_members_create_request_body is not None: + _body_params = loyalties_members_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/members', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_earning_rule( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_earning_rules_create_request_body_item: Annotated[Optional[List[LoyaltiesEarningRulesCreateRequestBodyItem]], Field(description="Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[LoyaltiesEarningRulesCreateResponseBody]: + """Create Earning Rule + + Create earning rules for a loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_earning_rules_create_request_body_item: Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object + :type loyalties_earning_rules_create_request_body_item: List[LoyaltiesEarningRulesCreateRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_earning_rule_serialize( + campaign_id=campaign_id, + loyalties_earning_rules_create_request_body_item=loyalties_earning_rules_create_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "List[LoyaltiesEarningRulesCreateResponseBody]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_earning_rule_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_earning_rules_create_request_body_item: Annotated[Optional[List[LoyaltiesEarningRulesCreateRequestBodyItem]], Field(description="Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[LoyaltiesEarningRulesCreateResponseBody]]: + """Create Earning Rule + + Create earning rules for a loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_earning_rules_create_request_body_item: Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object + :type loyalties_earning_rules_create_request_body_item: List[LoyaltiesEarningRulesCreateRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_earning_rule_serialize( + campaign_id=campaign_id, + loyalties_earning_rules_create_request_body_item=loyalties_earning_rules_create_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "List[LoyaltiesEarningRulesCreateResponseBody]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_earning_rule_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_earning_rules_create_request_body_item: Annotated[Optional[List[LoyaltiesEarningRulesCreateRequestBodyItem]], Field(description="Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Earning Rule + + Create earning rules for a loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_earning_rules_create_request_body_item: Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are event and loyalty. Additionally, if you choose to add a validity_timeframe, you must include a start_date. Furthermore, an earning rule event type: - customer.segment.entered requires a segment object - a custom event requires a custom_event object - a customer.loyalty.tier.joined, customer.loyalty.tier.left, customer.loyalty.tier.upgraded, customer.loyalty.tier.downgraded, customer.loyalty.tier.prolonged requires a loyalty_tier object + :type loyalties_earning_rules_create_request_body_item: List[LoyaltiesEarningRulesCreateRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_earning_rule_serialize( + campaign_id=campaign_id, + loyalties_earning_rules_create_request_body_item=loyalties_earning_rules_create_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "List[LoyaltiesEarningRulesCreateResponseBody]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_earning_rule_serialize( + self, + campaign_id, + loyalties_earning_rules_create_request_body_item, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'LoyaltiesEarningRulesCreateRequestBodyItem': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_earning_rules_create_request_body_item is not None: + _body_params = loyalties_earning_rules_create_request_body_item + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/earning-rules', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_in_bulk_loyalty_tiers( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + loyalties_tiers_create_in_bulk_request_body_item: Annotated[Optional[List[LoyaltiesTiersCreateInBulkRequestBodyItem]], Field(description="Provide tier definitions you want to add to existing loyalty campaign.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[LoyaltyTier]: + """Create loyalty tiers + + Creates loyalty tiers for desired campaign. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param loyalties_tiers_create_in_bulk_request_body_item: Provide tier definitions you want to add to existing loyalty campaign. + :type loyalties_tiers_create_in_bulk_request_body_item: List[LoyaltiesTiersCreateInBulkRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_in_bulk_loyalty_tiers_serialize( + campaign_id=campaign_id, + loyalties_tiers_create_in_bulk_request_body_item=loyalties_tiers_create_in_bulk_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "List[LoyaltyTier]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_in_bulk_loyalty_tiers_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + loyalties_tiers_create_in_bulk_request_body_item: Annotated[Optional[List[LoyaltiesTiersCreateInBulkRequestBodyItem]], Field(description="Provide tier definitions you want to add to existing loyalty campaign.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[LoyaltyTier]]: + """Create loyalty tiers + + Creates loyalty tiers for desired campaign. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param loyalties_tiers_create_in_bulk_request_body_item: Provide tier definitions you want to add to existing loyalty campaign. + :type loyalties_tiers_create_in_bulk_request_body_item: List[LoyaltiesTiersCreateInBulkRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_in_bulk_loyalty_tiers_serialize( + campaign_id=campaign_id, + loyalties_tiers_create_in_bulk_request_body_item=loyalties_tiers_create_in_bulk_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "List[LoyaltyTier]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_in_bulk_loyalty_tiers_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + loyalties_tiers_create_in_bulk_request_body_item: Annotated[Optional[List[LoyaltiesTiersCreateInBulkRequestBodyItem]], Field(description="Provide tier definitions you want to add to existing loyalty campaign.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create loyalty tiers + + Creates loyalty tiers for desired campaign. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param loyalties_tiers_create_in_bulk_request_body_item: Provide tier definitions you want to add to existing loyalty campaign. + :type loyalties_tiers_create_in_bulk_request_body_item: List[LoyaltiesTiersCreateInBulkRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_in_bulk_loyalty_tiers_serialize( + campaign_id=campaign_id, + loyalties_tiers_create_in_bulk_request_body_item=loyalties_tiers_create_in_bulk_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "List[LoyaltyTier]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_in_bulk_loyalty_tiers_serialize( + self, + campaign_id, + loyalties_tiers_create_in_bulk_request_body_item, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'LoyaltiesTiersCreateInBulkRequestBodyItem': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_tiers_create_in_bulk_request_body_item is not None: + _body_params = loyalties_tiers_create_in_bulk_request_body_item + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/tiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_loyalty_program( + self, + loyalties_create_campaign_request_body: Annotated[Optional[LoyaltiesCreateCampaignRequestBody], Field(description="Specify the loyalty campaign details.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesCreateCampaignResponseBody: + """Create Loyalty Campaign + + Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. ๐Ÿ“˜ Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. ๐Ÿšง Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + + :param loyalties_create_campaign_request_body: Specify the loyalty campaign details. + :type loyalties_create_campaign_request_body: LoyaltiesCreateCampaignRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_loyalty_program_serialize( + loyalties_create_campaign_request_body=loyalties_create_campaign_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesCreateCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_loyalty_program_with_http_info( + self, + loyalties_create_campaign_request_body: Annotated[Optional[LoyaltiesCreateCampaignRequestBody], Field(description="Specify the loyalty campaign details.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesCreateCampaignResponseBody]: + """Create Loyalty Campaign + + Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. ๐Ÿ“˜ Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. ๐Ÿšง Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + + :param loyalties_create_campaign_request_body: Specify the loyalty campaign details. + :type loyalties_create_campaign_request_body: LoyaltiesCreateCampaignRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_loyalty_program_serialize( + loyalties_create_campaign_request_body=loyalties_create_campaign_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesCreateCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_loyalty_program_without_preload_content( + self, + loyalties_create_campaign_request_body: Annotated[Optional[LoyaltiesCreateCampaignRequestBody], Field(description="Specify the loyalty campaign details.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Loyalty Campaign + + Creates a batch of loyalty cards aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. ๐Ÿ“˜ Global uniqueness All codes are unique across the whole project. Voucherify wont allow to generate the same codes in any of your campaigns. ๐Ÿšง Asyncronous action! This is an asynchronous action, you cant read or modify a newly created campaign until the code generation is completed. See creation_status field in the loyalty campaign object description. + + :param loyalties_create_campaign_request_body: Specify the loyalty campaign details. + :type loyalties_create_campaign_request_body: LoyaltiesCreateCampaignRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_loyalty_program_serialize( + loyalties_create_campaign_request_body=loyalties_create_campaign_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesCreateCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_loyalty_program_serialize( + self, + loyalties_create_campaign_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_create_campaign_request_body is not None: + _body_params = loyalties_create_campaign_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_points_expiration_export( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalties_points_expiration_export_create_request_body: Annotated[Optional[LoyaltiesPointsExpirationExportCreateRequestBody], Field(description="Specify the data filters, types of data to return and order in which the results should be returned.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesPointsExpirationExportCreateResponseBody: + """Create Points Expiration Export + + Schedule the generation of a points expiration CSV file for a particular campaign. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalties_points_expiration_export_create_request_body: Specify the data filters, types of data to return and order in which the results should be returned. + :type loyalties_points_expiration_export_create_request_body: LoyaltiesPointsExpirationExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_points_expiration_export_serialize( + campaign_id=campaign_id, + loyalties_points_expiration_export_create_request_body=loyalties_points_expiration_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesPointsExpirationExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_points_expiration_export_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalties_points_expiration_export_create_request_body: Annotated[Optional[LoyaltiesPointsExpirationExportCreateRequestBody], Field(description="Specify the data filters, types of data to return and order in which the results should be returned.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesPointsExpirationExportCreateResponseBody]: + """Create Points Expiration Export + + Schedule the generation of a points expiration CSV file for a particular campaign. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalties_points_expiration_export_create_request_body: Specify the data filters, types of data to return and order in which the results should be returned. + :type loyalties_points_expiration_export_create_request_body: LoyaltiesPointsExpirationExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_points_expiration_export_serialize( + campaign_id=campaign_id, + loyalties_points_expiration_export_create_request_body=loyalties_points_expiration_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesPointsExpirationExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_points_expiration_export_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalties_points_expiration_export_create_request_body: Annotated[Optional[LoyaltiesPointsExpirationExportCreateRequestBody], Field(description="Specify the data filters, types of data to return and order in which the results should be returned.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Points Expiration Export + + Schedule the generation of a points expiration CSV file for a particular campaign. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalties_points_expiration_export_create_request_body: Specify the data filters, types of data to return and order in which the results should be returned. + :type loyalties_points_expiration_export_create_request_body: LoyaltiesPointsExpirationExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_points_expiration_export_serialize( + campaign_id=campaign_id, + loyalties_points_expiration_export_create_request_body=loyalties_points_expiration_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesPointsExpirationExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_points_expiration_export_serialize( + self, + campaign_id, + loyalties_points_expiration_export_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_points_expiration_export_create_request_body is not None: + _body_params = loyalties_points_expiration_export_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/points-expiration/export', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_reward_assignment1( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_rewards_create_assignment_item_request_body: Annotated[Optional[List[LoyaltiesRewardsCreateAssignmentItemRequestBody]], Field(description="Define the cost of the rewards in loyalty points.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesRewardsCreateAssignmentResponseBody: + """Create Reward Assignment + + Add rewards to a loyalty campaign. + + :param campaign_id: Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_rewards_create_assignment_item_request_body: Define the cost of the rewards in loyalty points. + :type loyalties_rewards_create_assignment_item_request_body: List[LoyaltiesRewardsCreateAssignmentItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_assignment1_serialize( + campaign_id=campaign_id, + loyalties_rewards_create_assignment_item_request_body=loyalties_rewards_create_assignment_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsCreateAssignmentResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_reward_assignment1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_rewards_create_assignment_item_request_body: Annotated[Optional[List[LoyaltiesRewardsCreateAssignmentItemRequestBody]], Field(description="Define the cost of the rewards in loyalty points.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesRewardsCreateAssignmentResponseBody]: + """Create Reward Assignment + + Add rewards to a loyalty campaign. + + :param campaign_id: Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_rewards_create_assignment_item_request_body: Define the cost of the rewards in loyalty points. + :type loyalties_rewards_create_assignment_item_request_body: List[LoyaltiesRewardsCreateAssignmentItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_assignment1_serialize( + campaign_id=campaign_id, + loyalties_rewards_create_assignment_item_request_body=loyalties_rewards_create_assignment_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsCreateAssignmentResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_reward_assignment1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_rewards_create_assignment_item_request_body: Annotated[Optional[List[LoyaltiesRewardsCreateAssignmentItemRequestBody]], Field(description="Define the cost of the rewards in loyalty points.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Reward Assignment + + Add rewards to a loyalty campaign. + + :param campaign_id: Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_rewards_create_assignment_item_request_body: Define the cost of the rewards in loyalty points. + :type loyalties_rewards_create_assignment_item_request_body: List[LoyaltiesRewardsCreateAssignmentItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_assignment1_serialize( + campaign_id=campaign_id, + loyalties_rewards_create_assignment_item_request_body=loyalties_rewards_create_assignment_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsCreateAssignmentResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_reward_assignment1_serialize( + self, + campaign_id, + loyalties_rewards_create_assignment_item_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'LoyaltiesRewardsCreateAssignmentItemRequestBody': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_rewards_create_assignment_item_request_body is not None: + _body_params = loyalties_rewards_create_assignment_item_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/rewards', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_earning_rule( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Earning Rule + + This method deletes an earning rule for a specific loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_earning_rule_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Earning Rule + + This method deletes an earning rule for a specific loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_earning_rule_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Earning Rule + + This method deletes an earning rule for a specific loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_earning_rule_serialize( + self, + campaign_id, + earning_rule_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if earning_rule_id is not None: + _path_params['earningRuleId'] = earning_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_loyalty_program( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesDeleteResponseBody: + """Delete Loyalty Campaign + + Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param force: If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_loyalty_program_serialize( + campaign_id=campaign_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesDeleteResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_loyalty_program_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesDeleteResponseBody]: + """Delete Loyalty Campaign + + Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param force: If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_loyalty_program_serialize( + campaign_id=campaign_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesDeleteResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_loyalty_program_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Loyalty Campaign + + Deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards. If the force parameter is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param force: If this flag is set to true, the campaign and related vouchers will be removed permanently. If it is set to false or not set at all, the loyalty campaign and all related loyalty cards will be moved to the bin. Going forward, the user will be able to create the next campaign with the same name. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_loyalty_program_serialize( + campaign_id=campaign_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesDeleteResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_loyalty_program_serialize( + self, + campaign_id, + force, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if force is not None: + + _query_params.append(('force', force)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/loyalties/{campaignId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_reward_assignment1( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Reward Assignment + + This method deletes a reward assignment for a particular loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_reward_assignment1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Reward Assignment + + This method deletes a reward assignment for a particular loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_reward_assignment1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Reward Assignment + + This method deletes a reward assignment for a particular loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_reward_assignment1_serialize( + self, + campaign_id, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/loyalties/{campaignId}/rewards/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def disable_earning_rule( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + earning_rule_id: Annotated[StrictStr, Field(description="Unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesEarningRulesDisableResponseBody: + """Disable Earning Rule + + Disable an earning rule. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param earning_rule_id: Unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def disable_earning_rule_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + earning_rule_id: Annotated[StrictStr, Field(description="Unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesEarningRulesDisableResponseBody]: + """Disable Earning Rule + + Disable an earning rule. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param earning_rule_id: Unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def disable_earning_rule_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + earning_rule_id: Annotated[StrictStr, Field(description="Unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disable Earning Rule + + Disable an earning rule. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param earning_rule_id: Unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _disable_earning_rule_serialize( + self, + campaign_id, + earning_rule_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if earning_rule_id is not None: + _path_params['earningRuleId'] = earning_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def enable_earning_rule( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + earning_rule_id: Annotated[StrictStr, Field(description="Unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesEarningRulesEnableResponseBody: + """Enable Earning Rule + + Enable an earning rule. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param earning_rule_id: Unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def enable_earning_rule_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + earning_rule_id: Annotated[StrictStr, Field(description="Unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesEarningRulesEnableResponseBody]: + """Enable Earning Rule + + Enable an earning rule. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param earning_rule_id: Unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def enable_earning_rule_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + earning_rule_id: Annotated[StrictStr, Field(description="Unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enable Earning Rule + + Enable an earning rule. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param earning_rule_id: Unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _enable_earning_rule_serialize( + self, + campaign_id, + earning_rule_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if earning_rule_id is not None: + _path_params['earningRuleId'] = earning_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def export_loyalty_card_transactions( + self, + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to export transaction data for.")], + loyalties_members_transactions_export_create_request_body: Annotated[Optional[LoyaltiesMembersTransactionsExportCreateRequestBody], Field(description="Specify the parameters and filters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersTransactionsExportCreateResponseBody: + """Export Loyalty Card Transactions + + Export transactions that are associated with point movements on a loyalty card. + + :param member_id: A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + :type member_id: str + :param loyalties_members_transactions_export_create_request_body: Specify the parameters and filters for the transaction export. + :type loyalties_members_transactions_export_create_request_body: LoyaltiesMembersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_loyalty_card_transactions_serialize( + member_id=member_id, + loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def export_loyalty_card_transactions_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to export transaction data for.")], + loyalties_members_transactions_export_create_request_body: Annotated[Optional[LoyaltiesMembersTransactionsExportCreateRequestBody], Field(description="Specify the parameters and filters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersTransactionsExportCreateResponseBody]: + """Export Loyalty Card Transactions + + Export transactions that are associated with point movements on a loyalty card. + + :param member_id: A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + :type member_id: str + :param loyalties_members_transactions_export_create_request_body: Specify the parameters and filters for the transaction export. + :type loyalties_members_transactions_export_create_request_body: LoyaltiesMembersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_loyalty_card_transactions_serialize( + member_id=member_id, + loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def export_loyalty_card_transactions_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to export transaction data for.")], + loyalties_members_transactions_export_create_request_body: Annotated[Optional[LoyaltiesMembersTransactionsExportCreateRequestBody], Field(description="Specify the parameters and filters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Export Loyalty Card Transactions + + Export transactions that are associated with point movements on a loyalty card. + + :param member_id: A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + :type member_id: str + :param loyalties_members_transactions_export_create_request_body: Specify the parameters and filters for the transaction export. + :type loyalties_members_transactions_export_create_request_body: LoyaltiesMembersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_loyalty_card_transactions_serialize( + member_id=member_id, + loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_loyalty_card_transactions_serialize( + self, + member_id, + loyalties_members_transactions_export_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_members_transactions_export_create_request_body is not None: + _body_params = loyalties_members_transactions_export_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/members/{memberId}/transactions/export', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def export_loyalty_card_transactions1( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export.")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to export transaction data for.")], + loyalties_members_transactions_export_create_request_body: Annotated[Optional[LoyaltiesMembersTransactionsExportCreateRequestBody], Field(description="Specify the parameters and filters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersTransactionsExportCreateResponseBody: + """Export Loyalty Card Transactions + + Export transactions that are associated with point movements on a loyalty card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + :type member_id: str + :param loyalties_members_transactions_export_create_request_body: Specify the parameters and filters for the transaction export. + :type loyalties_members_transactions_export_create_request_body: LoyaltiesMembersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_loyalty_card_transactions1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def export_loyalty_card_transactions1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export.")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to export transaction data for.")], + loyalties_members_transactions_export_create_request_body: Annotated[Optional[LoyaltiesMembersTransactionsExportCreateRequestBody], Field(description="Specify the parameters and filters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersTransactionsExportCreateResponseBody]: + """Export Loyalty Card Transactions + + Export transactions that are associated with point movements on a loyalty card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + :type member_id: str + :param loyalties_members_transactions_export_create_request_body: Specify the parameters and filters for the transaction export. + :type loyalties_members_transactions_export_create_request_body: LoyaltiesMembersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_loyalty_card_transactions1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def export_loyalty_card_transactions1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export.")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to export transaction data for.")], + loyalties_members_transactions_export_create_request_body: Annotated[Optional[LoyaltiesMembersTransactionsExportCreateRequestBody], Field(description="Specify the parameters and filters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Export Loyalty Card Transactions + + Export transactions that are associated with point movements on a loyalty card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export. (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card that you are looking to export transaction data for. (required) + :type member_id: str + :param loyalties_members_transactions_export_create_request_body: Specify the parameters and filters for the transaction export. + :type loyalties_members_transactions_export_create_request_body: LoyaltiesMembersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_loyalty_card_transactions1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_transactions_export_create_request_body=loyalties_members_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_loyalty_card_transactions1_serialize( + self, + campaign_id, + member_id, + loyalties_members_transactions_export_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_members_transactions_export_create_request_body is not None: + _body_params = loyalties_members_transactions_export_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}/transactions/export', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_earning_rule( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesEarningRulesGetResponseBody: + """Get Earning Rule + + Retrieves an earning rule assigned to a campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_earning_rule_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesEarningRulesGetResponseBody]: + """Get Earning Rule + + Retrieves an earning rule assigned to a campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_earning_rule_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Earning Rule + + Retrieves an earning rule assigned to a campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_earning_rule_serialize( + self, + campaign_id, + earning_rule_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if earning_rule_id is not None: + _path_params['earningRuleId'] = earning_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_loyalty_program( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesGetCampaignResponseBody: + """Get Loyalty Campaign + + Retrieve a specific loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_loyalty_program_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesGetCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_loyalty_program_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesGetCampaignResponseBody]: + """Get Loyalty Campaign + + Retrieve a specific loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_loyalty_program_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesGetCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_loyalty_program_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Loyalty Campaign + + Retrieve a specific loyalty campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_loyalty_program_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesGetCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_loyalty_program_serialize( + self, + campaign_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_loyalty_tier( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesTiersGetResponseBody: + """Get Loyalty Tier + + Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_loyalty_tier_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_loyalty_tier_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesTiersGetResponseBody]: + """Get Loyalty Tier + + Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_loyalty_tier_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_loyalty_tier_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Loyalty Tier + + Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_loyalty_tier_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_loyalty_tier_serialize( + self, + campaign_id, + loyalty_tier_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if loyalty_tier_id is not None: + _path_params['loyaltyTierId'] = loyalty_tier_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_member( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card code assigned to a particular customer.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersGetResponseBody: + """Get Member + + Retrieve loyalty card with the given member ID (i.e. voucher code). ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card code assigned to a particular customer. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_member_serialize( + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_member_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card code assigned to a particular customer.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersGetResponseBody]: + """Get Member + + Retrieve loyalty card with the given member ID (i.e. voucher code). ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card code assigned to a particular customer. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_member_serialize( + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_member_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card code assigned to a particular customer.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Member + + Retrieve loyalty card with the given member ID (i.e. voucher code). ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to retrieve loyalty card details without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card code assigned to a particular customer. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_member_serialize( + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_member_serialize( + self, + member_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/members/{memberId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_member1( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="Unique code that identifies the loyalty card.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersGetResponseBody: + """Get Member + + Retrieves the loyalty card with the given member ID (i.e. voucher code). + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: Unique code that identifies the loyalty card. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_member1_serialize( + campaign_id=campaign_id, + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_member1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="Unique code that identifies the loyalty card.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersGetResponseBody]: + """Get Member + + Retrieves the loyalty card with the given member ID (i.e. voucher code). + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: Unique code that identifies the loyalty card. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_member1_serialize( + campaign_id=campaign_id, + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_member1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="Unique code that identifies the loyalty card.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Member + + Retrieves the loyalty card with the given member ID (i.e. voucher code). + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: Unique code that identifies the loyalty card. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_member1_serialize( + campaign_id=campaign_id, + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_member1_serialize( + self, + campaign_id, + member_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_reward_assignment1( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="Unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesRewardAssignmentsGetResponseBody: + """Get Reward Assignment + + Retrieve specific reward assignment. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: Unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_reward_assignment1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="Unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesRewardAssignmentsGetResponseBody]: + """Get Reward Assignment + + Retrieve specific reward assignment. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: Unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_reward_assignment1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="Unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Reward Assignment + + Retrieve specific reward assignment. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: Unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_reward_assignment1_serialize( + self, + campaign_id, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_reward_assignment2( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesRewardsGetResponseBody: + """Get Reward Assignment + + Retrieve specific reward assignment. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment2_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_reward_assignment2_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesRewardsGetResponseBody]: + """Get Reward Assignment + + Retrieve specific reward assignment. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment2_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_reward_assignment2_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Reward Assignment + + Retrieve specific reward assignment. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment2_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_reward_assignment2_serialize( + self, + campaign_id, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/rewards/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_reward_details( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="Unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesRewardAssignmentsRewardGetResponseBody: + """Get Reward Details + + Get reward details in the context of a loyalty campaign and reward assignment ID. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: Unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_details_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsRewardGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_reward_details_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="Unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesRewardAssignmentsRewardGetResponseBody]: + """Get Reward Details + + Get reward details in the context of a loyalty campaign and reward assignment ID. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: Unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_details_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsRewardGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_reward_details_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="Unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Reward Details + + Get reward details in the context of a loyalty campaign and reward assignment ID. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: Unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_details_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsRewardGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_reward_details_serialize( + self, + campaign_id, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_earning_rules( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListEarningRules], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesEarningRulesListResponseBody: + """List Earning Rules + + Returns a list of all earning rules within a given campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListEarningRules + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_earning_rules_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_earning_rules_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListEarningRules], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesEarningRulesListResponseBody]: + """List Earning Rules + + Returns a list of all earning rules within a given campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListEarningRules + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_earning_rules_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_earning_rules_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListEarningRules], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Earning Rules + + Returns a list of all earning rules within a given campaign. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListEarningRules + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_earning_rules_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_earning_rules_serialize( + self, + campaign_id, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/earning-rules', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_loyalty_card_transactions( + self, + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to retrieve transaction data for.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersTransactionsListResponseBody: + """List Loyalty Card Transactions + + Retrieve transaction data related to point movements for a specific loyalty card. + + :param member_id: A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_card_transactions_serialize( + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_loyalty_card_transactions_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to retrieve transaction data for.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersTransactionsListResponseBody]: + """List Loyalty Card Transactions + + Retrieve transaction data related to point movements for a specific loyalty card. + + :param member_id: A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_card_transactions_serialize( + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_loyalty_card_transactions_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to retrieve transaction data for.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Loyalty Card Transactions + + Retrieve transaction data related to point movements for a specific loyalty card. + + :param member_id: A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_card_transactions_serialize( + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_loyalty_card_transactions_serialize( + self, + member_id, + limit, + order, + starting_after_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after_id is not None: + + _query_params.append(('starting_after_id', starting_after_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/members/{memberId}/transactions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_loyalty_card_transactions1( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return.")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to retrieve transaction data for.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersTransactionsListResponseBody: + """List Loyalty Card Transactions + + Retrieve transaction data related to point movements for a specific loyalty card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_card_transactions1_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_loyalty_card_transactions1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return.")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to retrieve transaction data for.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersTransactionsListResponseBody]: + """List Loyalty Card Transactions + + Retrieve transaction data related to point movements for a specific loyalty card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_card_transactions1_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_loyalty_card_transactions1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return.")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card that you are looking to retrieve transaction data for.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Loyalty Card Transactions + + Retrieve transaction data related to point movements for a specific loyalty card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return. (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card that you are looking to retrieve transaction data for. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_card_transactions1_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_loyalty_card_transactions1_serialize( + self, + campaign_id, + member_id, + limit, + order, + starting_after_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after_id is not None: + + _query_params.append(('starting_after_id', starting_after_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}/transactions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_loyalty_programs( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListCampaigns], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesListCampaignsResponseBody: + """List Loyalty Campaigns + + Returns a list of your loyalty campaigns. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCampaigns + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_programs_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesListCampaignsResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_loyalty_programs_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListCampaigns], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesListCampaignsResponseBody]: + """List Loyalty Campaigns + + Returns a list of your loyalty campaigns. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCampaigns + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_programs_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesListCampaignsResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_loyalty_programs_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListCampaigns], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Loyalty Campaigns + + Returns a list of your loyalty campaigns. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListCampaigns + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_programs_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesListCampaignsResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_loyalty_programs_serialize( + self, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_loyalty_tier_earning_rules( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesTiersEarningRulesListResponseBody: + """List Loyalty Tier Earning Rules + + Retrieve available earning rules for a given tier and the calculation method for earning points. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tier_earning_rules_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersEarningRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_loyalty_tier_earning_rules_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesTiersEarningRulesListResponseBody]: + """List Loyalty Tier Earning Rules + + Retrieve available earning rules for a given tier and the calculation method for earning points. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tier_earning_rules_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersEarningRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_loyalty_tier_earning_rules_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Loyalty Tier Earning Rules + + Retrieve available earning rules for a given tier and the calculation method for earning points. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tier_earning_rules_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersEarningRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_loyalty_tier_earning_rules_serialize( + self, + campaign_id, + loyalty_tier_id, + limit, + page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if loyalty_tier_id is not None: + _path_params['loyaltyTierId'] = loyalty_tier_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_loyalty_tier_rewards( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesTiersRewardsListResponseBody: + """List Loyalty Tier Rewards + + Get available rewards for a given tier. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tier_rewards_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersRewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_loyalty_tier_rewards_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesTiersRewardsListResponseBody]: + """List Loyalty Tier Rewards + + Get available rewards for a given tier. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tier_rewards_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersRewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_loyalty_tier_rewards_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name.")], + loyalty_tier_id: Annotated[StrictStr, Field(description="Unique loyalty tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Loyalty Tier Rewards + + Get available rewards for a given tier. + + :param campaign_id: Unique campaign ID or name. (required) + :type campaign_id: str + :param loyalty_tier_id: Unique loyalty tier ID. (required) + :type loyalty_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tier_rewards_serialize( + campaign_id=campaign_id, + loyalty_tier_id=loyalty_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersRewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_loyalty_tier_rewards_serialize( + self, + campaign_id, + loyalty_tier_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if loyalty_tier_id is not None: + _path_params['loyaltyTierId'] = loyalty_tier_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_loyalty_tiers( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListLoyaltyTiers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesTiersListResponseBody: + """List Loyalty Tiers + + Retrieve a list of loyalty tiers which were added to the loyalty program. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListLoyaltyTiers + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tiers_serialize( + campaign_id=campaign_id, + limit=limit, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_loyalty_tiers_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListLoyaltyTiers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesTiersListResponseBody]: + """List Loyalty Tiers + + Retrieve a list of loyalty tiers which were added to the loyalty program. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListLoyaltyTiers + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tiers_serialize( + campaign_id=campaign_id, + limit=limit, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_loyalty_tiers_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique loyalty campaign ID or name.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListLoyaltyTiers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Loyalty Tiers + + Retrieve a list of loyalty tiers which were added to the loyalty program. + + :param campaign_id: Unique loyalty campaign ID or name. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListLoyaltyTiers + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_loyalty_tiers_serialize( + campaign_id=campaign_id, + limit=limit, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_loyalty_tiers_serialize( + self, + campaign_id, + limit, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/tiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_member_activity( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMemberActivityListResponseBody: + """List Member Activity + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_activity_serialize( + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMemberActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_member_activity_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMemberActivityListResponseBody]: + """List Member Activity + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_activity_serialize( + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMemberActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_member_activity_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Member Activity + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to get member activities without having to provide the campaignId as a path parameter. Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_activity_serialize( + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMemberActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_member_activity_serialize( + self, + member_id, + limit, + order, + starting_after_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after_id is not None: + + _query_params.append(('starting_after_id', starting_after_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/members/{memberId}/activity', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_member_activity1( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMemberActivityListResponseBody: + """List Member Activity + + Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_activity1_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMemberActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_member_activity1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMemberActivityListResponseBody]: + """List Member Activity + + Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_activity1_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMemberActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_member_activity1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderCreatedAt], Field(description="Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the events starting after an event with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Member Activity + + Retrieves the list of activities for the given member ID related to a voucher and customer who is the holder of the voucher. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Apply this filter to order the events according the date and time when it was created. The dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderCreatedAt + :param starting_after_id: A cursor for pagination. It retrieves the events starting after an event with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_activity1_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMemberActivityListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_member_activity1_serialize( + self, + campaign_id, + member_id, + limit, + order, + starting_after_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after_id is not None: + + _query_params.append(('starting_after_id', starting_after_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}/activity', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_member_loyalty_tier( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersTiersListResponseBody: + """List Member's Loyalty Tiers + + Retrieve member tiers using the loyalty card ID. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_loyalty_tier_serialize( + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_member_loyalty_tier_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersTiersListResponseBody]: + """List Member's Loyalty Tiers + + Retrieve member tiers using the loyalty card ID. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_loyalty_tier_serialize( + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_member_loyalty_tier_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Member's Loyalty Tiers + + Retrieve member tiers using the loyalty card ID. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_loyalty_tier_serialize( + member_id=member_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_member_loyalty_tier_serialize( + self, + member_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/members/{memberId}/tiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_member_rewards( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + affordable_only: Annotated[Optional[StrictBool], Field(description="Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersRewardsListResponseBody: + """List Member Rewards + + Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param affordable_only: Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. + :type affordable_only: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_rewards_serialize( + member_id=member_id, + affordable_only=affordable_only, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_member_rewards_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + affordable_only: Annotated[Optional[StrictBool], Field(description="Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersRewardsListResponseBody]: + """List Member Rewards + + Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param affordable_only: Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. + :type affordable_only: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_rewards_serialize( + member_id=member_id, + affordable_only=affordable_only, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_member_rewards_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + affordable_only: Annotated[Optional[StrictBool], Field(description="Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Member Rewards + + Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param affordable_only: Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford. + :type affordable_only: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_member_rewards_serialize( + member_id=member_id, + affordable_only=affordable_only, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_member_rewards_serialize( + self, + member_id, + affordable_only, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + if affordable_only is not None: + + _query_params.append(('affordable_only', affordable_only)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/members/{memberId}/rewards', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_members( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID of the loyalty program.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + order: Annotated[Optional[ParameterOrderVouchers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + code: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesListMembersResponseBody: + """List Members + + Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. + + :param campaign_id: Unique campaign ID of the loyalty program. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param customer: A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + :type customer: str + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderVouchers + :param code: + :type code: str + :param ids: + :type ids: List[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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_members_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + customer=customer, + created_at=created_at, + updated_at=updated_at, + order=order, + code=code, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesListMembersResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_members_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID of the loyalty program.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + order: Annotated[Optional[ParameterOrderVouchers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + code: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesListMembersResponseBody]: + """List Members + + Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. + + :param campaign_id: Unique campaign ID of the loyalty program. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param customer: A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + :type customer: str + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderVouchers + :param code: + :type code: str + :param ids: + :type ids: List[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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_members_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + customer=customer, + created_at=created_at, + updated_at=updated_at, + order=order, + code=code, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesListMembersResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_members_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID of the loyalty program.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + order: Annotated[Optional[ParameterOrderVouchers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + code: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Members + + Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first. + + :param campaign_id: Unique campaign ID of the loyalty program. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param customer: A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + :type customer: str + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderVouchers + :param code: + :type code: str + :param ids: + :type ids: List[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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_members_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + customer=customer, + created_at=created_at, + updated_at=updated_at, + order=order, + code=code, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesListMembersResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_members_serialize( + self, + campaign_id, + limit, + page, + customer, + created_at, + updated_at, + order, + code, + ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'ids': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if customer is not None: + + _query_params.append(('customer', customer)) + + if created_at is not None: + + _query_params.append(('created_at', created_at)) + + if updated_at is not None: + + _query_params.append(('updated_at', updated_at)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if code is not None: + + _query_params.append(('code', code)) + + if ids is not None: + + _query_params.append(('ids', ids)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/members', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_points_expiration( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + member_id: Annotated[StrictStr, Field(description="Loyalty card code.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersPointsExpirationListResponseBody: + """Get Points Expiration + + Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param member_id: Loyalty card code. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_points_expiration_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersPointsExpirationListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_points_expiration_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + member_id: Annotated[StrictStr, Field(description="Loyalty card code.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersPointsExpirationListResponseBody]: + """Get Points Expiration + + Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param member_id: Loyalty card code. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_points_expiration_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersPointsExpirationListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_points_expiration_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + member_id: Annotated[StrictStr, Field(description="Loyalty card code.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Points Expiration + + Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param member_id: Loyalty card code. (required) + :type member_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_points_expiration_serialize( + campaign_id=campaign_id, + member_id=member_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersPointsExpirationListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_points_expiration_serialize( + self, + campaign_id, + member_id, + limit, + page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}/points-expiration', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_reward_assignments1( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesRewardAssignmentsListResponseBody: + """List Reward Assignments + + Returns reward assignments from a given loyalty campaign. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments1_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_reward_assignments1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesRewardAssignmentsListResponseBody]: + """List Reward Assignments + + Returns reward assignments from a given loyalty campaign. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments1_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_reward_assignments1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Reward Assignments + + Returns reward assignments from a given loyalty campaign. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to be more contextual to the type of data returned in the response. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments1_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_reward_assignments1_serialize( + self, + campaign_id, + limit, + page, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if assignment_id is not None: + + _query_params.append(('assignmentId', assignment_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/reward-assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_reward_assignments2( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesRewardsListAssignmentsResponseBody: + """List Reward Assignments + + Returns active rewards from a given loyalty campaign. + + :param campaign_id: Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments2_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsListAssignmentsResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_reward_assignments2_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesRewardsListAssignmentsResponseBody]: + """List Reward Assignments + + Returns active rewards from a given loyalty campaign. + + :param campaign_id: Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments2_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsListAssignmentsResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_reward_assignments2_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Reward Assignments + + Returns active rewards from a given loyalty campaign. + + :param campaign_id: Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments2_serialize( + campaign_id=campaign_id, + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsListAssignmentsResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_reward_assignments2_serialize( + self, + campaign_id, + limit, + page, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if assignment_id is not None: + + _query_params.append(('assignment_id', assignment_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/loyalties/{campaignId}/rewards', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def redeem_reward( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + loyalties_members_redemption_redeem_request_body: Annotated[Optional[LoyaltiesMembersRedemptionRedeemRequestBody], Field(description="Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersRedemptionRedeemResponseBody: + """Redeem Reward + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param loyalties_members_redemption_redeem_request_body: Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + :type loyalties_members_redemption_redeem_request_body: LoyaltiesMembersRedemptionRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_reward_serialize( + member_id=member_id, + loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRedemptionRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def redeem_reward_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + loyalties_members_redemption_redeem_request_body: Annotated[Optional[LoyaltiesMembersRedemptionRedeemRequestBody], Field(description="Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersRedemptionRedeemResponseBody]: + """Redeem Reward + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param loyalties_members_redemption_redeem_request_body: Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + :type loyalties_members_redemption_redeem_request_body: LoyaltiesMembersRedemptionRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_reward_serialize( + member_id=member_id, + loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRedemptionRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def redeem_reward_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + loyalties_members_redemption_redeem_request_body: Annotated[Optional[LoyaltiesMembersRedemptionRedeemRequestBody], Field(description="Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Redeem Reward + + ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param loyalties_members_redemption_redeem_request_body: Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + :type loyalties_members_redemption_redeem_request_body: LoyaltiesMembersRedemptionRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_reward_serialize( + member_id=member_id, + loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRedemptionRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _redeem_reward_serialize( + self, + member_id, + loyalties_members_redemption_redeem_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_members_redemption_redeem_request_body is not None: + _body_params = loyalties_members_redemption_redeem_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/members/{memberId}/redemption', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def redeem_reward1( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + loyalties_members_redemption_redeem_request_body: Annotated[Optional[LoyaltiesMembersRedemptionRedeemRequestBody], Field(description="Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersRedemptionRedeemResponseBody: + """Redeem Reward + + Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param loyalties_members_redemption_redeem_request_body: Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + :type loyalties_members_redemption_redeem_request_body: LoyaltiesMembersRedemptionRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_reward1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRedemptionRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def redeem_reward1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + loyalties_members_redemption_redeem_request_body: Annotated[Optional[LoyaltiesMembersRedemptionRedeemRequestBody], Field(description="Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersRedemptionRedeemResponseBody]: + """Redeem Reward + + Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param loyalties_members_redemption_redeem_request_body: Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + :type loyalties_members_redemption_redeem_request_body: LoyaltiesMembersRedemptionRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_reward1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRedemptionRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def redeem_reward1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + loyalties_members_redemption_redeem_request_body: Annotated[Optional[LoyaltiesMembersRedemptionRedeemRequestBody], Field(description="Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Redeem Reward + + Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param loyalties_members_redemption_redeem_request_body: Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order. + :type loyalties_members_redemption_redeem_request_body: LoyaltiesMembersRedemptionRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_reward1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_redemption_redeem_request_body=loyalties_members_redemption_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersRedemptionRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _redeem_reward1_serialize( + self, + campaign_id, + member_id, + loyalties_members_redemption_redeem_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_members_redemption_redeem_request_body is not None: + _body_params = loyalties_members_redemption_redeem_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}/redemption', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def transfer_points( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination).")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination).")], + loyalties_transfer_points: Annotated[Optional[List[LoyaltiesTransferPoints]], Field(description="Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersTransfersCreateResponseBody: + """Transfer Loyalty Points + + Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + :type member_id: str + :param loyalties_transfer_points: Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + :type loyalties_transfer_points: List[LoyaltiesTransferPoints] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._transfer_points_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_transfer_points=loyalties_transfer_points, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransfersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def transfer_points_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination).")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination).")], + loyalties_transfer_points: Annotated[Optional[List[LoyaltiesTransferPoints]], Field(description="Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersTransfersCreateResponseBody]: + """Transfer Loyalty Points + + Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + :type member_id: str + :param loyalties_transfer_points: Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + :type loyalties_transfer_points: List[LoyaltiesTransferPoints] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._transfer_points_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_transfer_points=loyalties_transfer_points, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransfersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def transfer_points_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination).")], + member_id: Annotated[StrictStr, Field(description="A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination).")], + loyalties_transfer_points: Annotated[Optional[List[LoyaltiesTransferPoints]], Field(description="Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Transfer Loyalty Points + + Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + + :param campaign_id: A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination). (required) + :type campaign_id: str + :param member_id: A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination). (required) + :type member_id: str + :param loyalties_transfer_points: Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card. + :type loyalties_transfer_points: List[LoyaltiesTransferPoints] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._transfer_points_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_transfer_points=loyalties_transfer_points, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersTransfersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _transfer_points_serialize( + self, + campaign_id, + member_id, + loyalties_transfer_points, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'LoyaltiesTransferPoints': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_transfer_points is not None: + _body_params = loyalties_transfer_points + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}/transfers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_earning_rule( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + loyalties_earning_rules_update_request_body: Annotated[Optional[LoyaltiesEarningRulesUpdateRequestBody], Field(description="Specify the parameters that you would like to update for the given earning rule.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesEarningRulesUpdateResponseBody: + """Update Earning Rule + + Update an earning rule definition. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: str + :param loyalties_earning_rules_update_request_body: Specify the parameters that you would like to update for the given earning rule. + :type loyalties_earning_rules_update_request_body: LoyaltiesEarningRulesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + loyalties_earning_rules_update_request_body=loyalties_earning_rules_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_earning_rule_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + loyalties_earning_rules_update_request_body: Annotated[Optional[LoyaltiesEarningRulesUpdateRequestBody], Field(description="Specify the parameters that you would like to update for the given earning rule.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesEarningRulesUpdateResponseBody]: + """Update Earning Rule + + Update an earning rule definition. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: str + :param loyalties_earning_rules_update_request_body: Specify the parameters that you would like to update for the given earning rule. + :type loyalties_earning_rules_update_request_body: LoyaltiesEarningRulesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + loyalties_earning_rules_update_request_body=loyalties_earning_rules_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_earning_rule_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + earning_rule_id: Annotated[StrictStr, Field(description="A unique earning rule ID.")], + loyalties_earning_rules_update_request_body: Annotated[Optional[LoyaltiesEarningRulesUpdateRequestBody], Field(description="Specify the parameters that you would like to update for the given earning rule.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Earning Rule + + Update an earning rule definition. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param earning_rule_id: A unique earning rule ID. (required) + :type earning_rule_id: str + :param loyalties_earning_rules_update_request_body: Specify the parameters that you would like to update for the given earning rule. + :type loyalties_earning_rules_update_request_body: LoyaltiesEarningRulesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_earning_rule_serialize( + campaign_id=campaign_id, + earning_rule_id=earning_rule_id, + loyalties_earning_rules_update_request_body=loyalties_earning_rules_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesEarningRulesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_earning_rule_serialize( + self, + campaign_id, + earning_rule_id, + loyalties_earning_rules_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if earning_rule_id is not None: + _path_params['earningRuleId'] = earning_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_earning_rules_update_request_body is not None: + _body_params = loyalties_earning_rules_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_loyalty_card_balance( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + loyalties_members_balance_update_request_body: Annotated[Optional[LoyaltiesMembersBalanceUpdateRequestBody], Field(description="Specify the point adjustment along with the expiration mechanism.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersBalanceUpdateResponseBody: + """Add or Remove Loyalty Card Balance + + This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param loyalties_members_balance_update_request_body: Specify the point adjustment along with the expiration mechanism. + :type loyalties_members_balance_update_request_body: LoyaltiesMembersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_card_balance_serialize( + member_id=member_id, + loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_loyalty_card_balance_with_http_info( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + loyalties_members_balance_update_request_body: Annotated[Optional[LoyaltiesMembersBalanceUpdateRequestBody], Field(description="Specify the point adjustment along with the expiration mechanism.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersBalanceUpdateResponseBody]: + """Add or Remove Loyalty Card Balance + + This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param loyalties_members_balance_update_request_body: Specify the point adjustment along with the expiration mechanism. + :type loyalties_members_balance_update_request_body: LoyaltiesMembersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_card_balance_serialize( + member_id=member_id, + loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_loyalty_card_balance_without_preload_content( + self, + member_id: Annotated[StrictStr, Field(description="Unique loyalty card assigned to a particular customer.")], + loyalties_members_balance_update_request_body: Annotated[Optional[LoyaltiesMembersBalanceUpdateRequestBody], Field(description="Specify the point adjustment along with the expiration mechanism.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add or Remove Loyalty Card Balance + + This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. ๐Ÿ“˜ Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter. + + :param member_id: Unique loyalty card assigned to a particular customer. (required) + :type member_id: str + :param loyalties_members_balance_update_request_body: Specify the point adjustment along with the expiration mechanism. + :type loyalties_members_balance_update_request_body: LoyaltiesMembersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_card_balance_serialize( + member_id=member_id, + loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_loyalty_card_balance_serialize( + self, + member_id, + loyalties_members_balance_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_members_balance_update_request_body is not None: + _body_params = loyalties_members_balance_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/members/{memberId}/balance', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_loyalty_card_balance1( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + loyalties_members_balance_update_request_body: Annotated[Optional[LoyaltiesMembersBalanceUpdateRequestBody], Field(description="Specify the point adjustment along with the expiration mechanism.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesMembersBalanceUpdateResponseBody: + """Add or Remove Loyalty Card Balance + + This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param loyalties_members_balance_update_request_body: Specify the point adjustment along with the expiration mechanism. + :type loyalties_members_balance_update_request_body: LoyaltiesMembersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_card_balance1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_loyalty_card_balance1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + loyalties_members_balance_update_request_body: Annotated[Optional[LoyaltiesMembersBalanceUpdateRequestBody], Field(description="Specify the point adjustment along with the expiration mechanism.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesMembersBalanceUpdateResponseBody]: + """Add or Remove Loyalty Card Balance + + This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param loyalties_members_balance_update_request_body: Specify the point adjustment along with the expiration mechanism. + :type loyalties_members_balance_update_request_body: LoyaltiesMembersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_card_balance1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_loyalty_card_balance1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + member_id: Annotated[StrictStr, Field(description="A code that identifies the loyalty card.")], + loyalties_members_balance_update_request_body: Annotated[Optional[LoyaltiesMembersBalanceUpdateRequestBody], Field(description="Specify the point adjustment along with the expiration mechanism.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add or Remove Loyalty Card Balance + + This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. >๐Ÿšง Async Action This is an async action. If you want to perform several add or remove loyalty card balance actions in a short time and their order matters, set up sufficient time-out between the calls. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param member_id: A code that identifies the loyalty card. (required) + :type member_id: str + :param loyalties_members_balance_update_request_body: Specify the point adjustment along with the expiration mechanism. + :type loyalties_members_balance_update_request_body: LoyaltiesMembersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_card_balance1_serialize( + campaign_id=campaign_id, + member_id=member_id, + loyalties_members_balance_update_request_body=loyalties_members_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesMembersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_loyalty_card_balance1_serialize( + self, + campaign_id, + member_id, + loyalties_members_balance_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if member_id is not None: + _path_params['memberId'] = member_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_members_balance_update_request_body is not None: + _body_params = loyalties_members_balance_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/loyalties/{campaignId}/members/{memberId}/balance', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_loyalty_program( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_update_campaign_request_body: Annotated[Optional[LoyaltiesUpdateCampaignRequestBody], Field(description="Specify the new values for the parameters that you would like to update for the given loyalty campaign.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesUpdateCampaignResponseBody: + """Update Loyalty Campaign + + Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_update_campaign_request_body: Specify the new values for the parameters that you would like to update for the given loyalty campaign. + :type loyalties_update_campaign_request_body: LoyaltiesUpdateCampaignRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_program_serialize( + campaign_id=campaign_id, + loyalties_update_campaign_request_body=loyalties_update_campaign_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesUpdateCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_loyalty_program_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_update_campaign_request_body: Annotated[Optional[LoyaltiesUpdateCampaignRequestBody], Field(description="Specify the new values for the parameters that you would like to update for the given loyalty campaign.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesUpdateCampaignResponseBody]: + """Update Loyalty Campaign + + Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_update_campaign_request_body: Specify the new values for the parameters that you would like to update for the given loyalty campaign. + :type loyalties_update_campaign_request_body: LoyaltiesUpdateCampaignRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_program_serialize( + campaign_id=campaign_id, + loyalties_update_campaign_request_body=loyalties_update_campaign_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesUpdateCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_loyalty_program_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + loyalties_update_campaign_request_body: Annotated[Optional[LoyaltiesUpdateCampaignRequestBody], Field(description="Specify the new values for the parameters that you would like to update for the given loyalty campaign.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Loyalty Campaign + + Updates a loyalty program. Fields other than those specified in the allowed request body payload wont be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. This method will update the loyalty cards which have not been published or redeemed yet. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param loyalties_update_campaign_request_body: Specify the new values for the parameters that you would like to update for the given loyalty campaign. + :type loyalties_update_campaign_request_body: LoyaltiesUpdateCampaignRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_loyalty_program_serialize( + campaign_id=campaign_id, + loyalties_update_campaign_request_body=loyalties_update_campaign_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesUpdateCampaignResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_loyalty_program_serialize( + self, + campaign_id, + loyalties_update_campaign_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_update_campaign_request_body is not None: + _body_params = loyalties_update_campaign_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/loyalties/{campaignId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_reward_assignment1( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + loyalties_rewards_update_assignment_request_body: Annotated[Optional[LoyaltiesRewardsUpdateAssignmentRequestBody], Field(description="Update the points cost for the reward assignment.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LoyaltiesRewardsUpdateAssignmentResponseBody: + """Update Reward Assignment + + Updates rewards parameters, i.e. the points cost for the specific reward. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: str + :param loyalties_rewards_update_assignment_request_body: Update the points cost for the reward assignment. + :type loyalties_rewards_update_assignment_request_body: LoyaltiesRewardsUpdateAssignmentRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + loyalties_rewards_update_assignment_request_body=loyalties_rewards_update_assignment_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsUpdateAssignmentResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_reward_assignment1_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + loyalties_rewards_update_assignment_request_body: Annotated[Optional[LoyaltiesRewardsUpdateAssignmentRequestBody], Field(description="Update the points cost for the reward assignment.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LoyaltiesRewardsUpdateAssignmentResponseBody]: + """Update Reward Assignment + + Updates rewards parameters, i.e. the points cost for the specific reward. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: str + :param loyalties_rewards_update_assignment_request_body: Update the points cost for the reward assignment. + :type loyalties_rewards_update_assignment_request_body: LoyaltiesRewardsUpdateAssignmentRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + loyalties_rewards_update_assignment_request_body=loyalties_rewards_update_assignment_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsUpdateAssignmentResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_reward_assignment1_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. ")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + loyalties_rewards_update_assignment_request_body: Annotated[Optional[LoyaltiesRewardsUpdateAssignmentRequestBody], Field(description="Update the points cost for the reward assignment.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Reward Assignment + + Updates rewards parameters, i.e. the points cost for the specific reward. + + :param campaign_id: The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign. (required) + :type campaign_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: str + :param loyalties_rewards_update_assignment_request_body: Update the points cost for the reward assignment. + :type loyalties_rewards_update_assignment_request_body: LoyaltiesRewardsUpdateAssignmentRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_assignment1_serialize( + campaign_id=campaign_id, + assignment_id=assignment_id, + loyalties_rewards_update_assignment_request_body=loyalties_rewards_update_assignment_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "LoyaltiesRewardsUpdateAssignmentResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_reward_assignment1_serialize( + self, + campaign_id, + assignment_id, + loyalties_rewards_update_assignment_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if loyalties_rewards_update_assignment_request_body is not None: + _body_params = loyalties_rewards_update_assignment_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/loyalties/{campaignId}/rewards/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/orders_api.py b/voucherify/api/orders_api.py new file mode 100644 index 00000000..4ef1a27e --- /dev/null +++ b/voucherify/api/orders_api.py @@ -0,0 +1,1714 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from voucherify.models.orders_create_request_body import OrdersCreateRequestBody +from voucherify.models.orders_create_response_body import OrdersCreateResponseBody +from voucherify.models.orders_export_create_request_body import OrdersExportCreateRequestBody +from voucherify.models.orders_export_create_response_body import OrdersExportCreateResponseBody +from voucherify.models.orders_get_response_body import OrdersGetResponseBody +from voucherify.models.orders_import_create_request_body_item import OrdersImportCreateRequestBodyItem +from voucherify.models.orders_import_create_response_body import OrdersImportCreateResponseBody +from voucherify.models.orders_list_response_body import OrdersListResponseBody +from voucherify.models.orders_update_request_body import OrdersUpdateRequestBody +from voucherify.models.orders_update_response_body import OrdersUpdateResponseBody +from voucherify.models.parameter_order_list_orders import ParameterOrderListOrders + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class OrdersApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_order( + self, + orders_create_request_body: Annotated[Optional[OrdersCreateRequestBody], Field(description="Specify the order parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrdersCreateResponseBody: + """Create Order + + Creates an order object and triggers an order creation event. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the order database, Voucherify will return a related order object with updated fields. + + :param orders_create_request_body: Specify the order parameters. + :type orders_create_request_body: OrdersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_order_serialize( + orders_create_request_body=orders_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_order_with_http_info( + self, + orders_create_request_body: Annotated[Optional[OrdersCreateRequestBody], Field(description="Specify the order parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrdersCreateResponseBody]: + """Create Order + + Creates an order object and triggers an order creation event. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the order database, Voucherify will return a related order object with updated fields. + + :param orders_create_request_body: Specify the order parameters. + :type orders_create_request_body: OrdersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_order_serialize( + orders_create_request_body=orders_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_order_without_preload_content( + self, + orders_create_request_body: Annotated[Optional[OrdersCreateRequestBody], Field(description="Specify the order parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Order + + Creates an order object and triggers an order creation event. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the order database, Voucherify will return a related order object with updated fields. + + :param orders_create_request_body: Specify the order parameters. + :type orders_create_request_body: OrdersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_order_serialize( + orders_create_request_body=orders_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_order_serialize( + self, + orders_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if orders_create_request_body is not None: + _body_params = orders_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/orders', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_order_export( + self, + orders_export_create_request_body: Annotated[Optional[OrdersExportCreateRequestBody], Field(description="Specify which order parameters you would like to export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrdersExportCreateResponseBody: + """Create Orders Export + + Creates a downloadable CSV file containing a list of orders. The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body. The available filters are all order object attributes. Additionally, any metadata defined in the metadata schema can be exported. Passing an empty JSON will generate a file containing three default fields: id, source_id, and status. The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: + + :param orders_export_create_request_body: Specify which order parameters you would like to export. + :type orders_export_create_request_body: OrdersExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_order_export_serialize( + orders_export_create_request_body=orders_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_order_export_with_http_info( + self, + orders_export_create_request_body: Annotated[Optional[OrdersExportCreateRequestBody], Field(description="Specify which order parameters you would like to export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrdersExportCreateResponseBody]: + """Create Orders Export + + Creates a downloadable CSV file containing a list of orders. The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body. The available filters are all order object attributes. Additionally, any metadata defined in the metadata schema can be exported. Passing an empty JSON will generate a file containing three default fields: id, source_id, and status. The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: + + :param orders_export_create_request_body: Specify which order parameters you would like to export. + :type orders_export_create_request_body: OrdersExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_order_export_serialize( + orders_export_create_request_body=orders_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_order_export_without_preload_content( + self, + orders_export_create_request_body: Annotated[Optional[OrdersExportCreateRequestBody], Field(description="Specify which order parameters you would like to export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Orders Export + + Creates a downloadable CSV file containing a list of orders. The parameters listed in the payload resembles headers in the CSV file. To include a parameter to the file, add it to the parameters.fields object in the request body. The available filters are all order object attributes. Additionally, any metadata defined in the metadata schema can be exported. Passing an empty JSON will generate a file containing three default fields: id, source_id, and status. The fields array is an array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: + + :param orders_export_create_request_body: Specify which order parameters you would like to export. + :type orders_export_create_request_body: OrdersExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_order_export_serialize( + orders_export_create_request_body=orders_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_order_export_serialize( + self, + orders_export_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if orders_export_create_request_body is not None: + _body_params = orders_export_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/orders/export', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_order( + self, + order_id: Annotated[StrictStr, Field(description="Unique Voucherify order ID or order source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrdersGetResponseBody: + """Get Order + + Retrieve an order. + + :param order_id: Unique Voucherify order ID or order source ID. (required) + :type order_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_order_serialize( + order_id=order_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_order_with_http_info( + self, + order_id: Annotated[StrictStr, Field(description="Unique Voucherify order ID or order source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrdersGetResponseBody]: + """Get Order + + Retrieve an order. + + :param order_id: Unique Voucherify order ID or order source ID. (required) + :type order_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_order_serialize( + order_id=order_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_order_without_preload_content( + self, + order_id: Annotated[StrictStr, Field(description="Unique Voucherify order ID or order source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Order + + Retrieve an order. + + :param order_id: Unique Voucherify order ID or order source ID. (required) + :type order_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_order_serialize( + order_id=order_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_order_serialize( + self, + order_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if order_id is not None: + _path_params['orderId'] = order_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/orders/{orderId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_orders( + self, + orders_import_create_request_body_item: Annotated[Optional[List[OrdersImportCreateRequestBodyItem]], Field(description="The request body is sent in the form of an array of order objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrdersImportCreateResponseBody: + """Import Orders + + ๐Ÿšง Historical orders This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the create order and update order endpoints should be used. This is critical because this endpoint does not store events or launch distributions. # Limitations ## Import volume There can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one. ## Maximum count of orders in single import There is a 2000 limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time. # Notifications There are no notifications on the Dashboard because this import is launched via the API. # Triggered actions If you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segments summary. Consequently, this update will trigger - **customers entering into segments** - **distributions** based on any rules tied to customer entering segment(s) - **earning rules** based on the customer entering segment(s) # What is not triggered 1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. 2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a PAID status, the distribution is not going to be triggered. 3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you wont see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / skus, then you wont see the Product created events listed, etc. 4. Earning rules based on Order Paid wont be triggered. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param orders_import_create_request_body_item: The request body is sent in the form of an array of order objects. + :type orders_import_create_request_body_item: List[OrdersImportCreateRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_orders_serialize( + orders_import_create_request_body_item=orders_import_create_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_orders_with_http_info( + self, + orders_import_create_request_body_item: Annotated[Optional[List[OrdersImportCreateRequestBodyItem]], Field(description="The request body is sent in the form of an array of order objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrdersImportCreateResponseBody]: + """Import Orders + + ๐Ÿšง Historical orders This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the create order and update order endpoints should be used. This is critical because this endpoint does not store events or launch distributions. # Limitations ## Import volume There can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one. ## Maximum count of orders in single import There is a 2000 limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time. # Notifications There are no notifications on the Dashboard because this import is launched via the API. # Triggered actions If you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segments summary. Consequently, this update will trigger - **customers entering into segments** - **distributions** based on any rules tied to customer entering segment(s) - **earning rules** based on the customer entering segment(s) # What is not triggered 1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. 2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a PAID status, the distribution is not going to be triggered. 3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you wont see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / skus, then you wont see the Product created events listed, etc. 4. Earning rules based on Order Paid wont be triggered. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param orders_import_create_request_body_item: The request body is sent in the form of an array of order objects. + :type orders_import_create_request_body_item: List[OrdersImportCreateRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_orders_serialize( + orders_import_create_request_body_item=orders_import_create_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_orders_without_preload_content( + self, + orders_import_create_request_body_item: Annotated[Optional[List[OrdersImportCreateRequestBodyItem]], Field(description="The request body is sent in the form of an array of order objects.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import Orders + + ๐Ÿšง Historical orders This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the create order and update order endpoints should be used. This is critical because this endpoint does not store events or launch distributions. # Limitations ## Import volume There can be only a single on-going order import per tenant per project at a given time. The user can schedule more imports but those extra imports will be scheduled to run in sequence one by one. ## Maximum count of orders in single import There is a 2000 limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time. # Notifications There are no notifications on the Dashboard because this import is launched via the API. # Triggered actions If you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segments summary. Consequently, this update will trigger - **customers entering into segments** - **distributions** based on any rules tied to customer entering segment(s) - **earning rules** based on the customer entering segment(s) # What is not triggered 1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. 2. Distributions based on Order Update, Order Paid, Order Created and Order Cancelled. In other words if you have a distribution based on Order Paid and you import an order with a PAID status, the distribution is not going to be triggered. 3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you wont see any events in the Activity tab in the Dashboard such as Order created or Order paid. If you are additionally upserting products / skus, then you wont see the Product created events listed, etc. 4. Earning rules based on Order Paid wont be triggered. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param orders_import_create_request_body_item: The request body is sent in the form of an array of order objects. + :type orders_import_create_request_body_item: List[OrdersImportCreateRequestBodyItem] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_orders_serialize( + orders_import_create_request_body_item=orders_import_create_request_body_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_orders_serialize( + self, + orders_import_create_request_body_item, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'OrdersImportCreateRequestBodyItem': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if orders_import_create_request_body_item is not None: + _body_params = orders_import_create_request_body_item + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/orders/import', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_orders( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListOrders], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrdersListResponseBody: + """List Orders + + Returns a list of orders. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListOrders + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_orders_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_orders_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListOrders], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrdersListResponseBody]: + """List Orders + + Returns a list of orders. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListOrders + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_orders_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_orders_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListOrders], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Orders + + Returns a list of orders. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListOrders + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_orders_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_orders_serialize( + self, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/orders', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_order( + self, + order_id: Annotated[StrictStr, Field(description="Unique Voucherify order ID or order source ID.")], + orders_update_request_body: Annotated[Optional[OrdersUpdateRequestBody], Field(description="Specify the parameters of the order that are to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrdersUpdateResponseBody: + """Update Order + + Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged. + + :param order_id: Unique Voucherify order ID or order source ID. (required) + :type order_id: str + :param orders_update_request_body: Specify the parameters of the order that are to be updated. + :type orders_update_request_body: OrdersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_order_serialize( + order_id=order_id, + orders_update_request_body=orders_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_order_with_http_info( + self, + order_id: Annotated[StrictStr, Field(description="Unique Voucherify order ID or order source ID.")], + orders_update_request_body: Annotated[Optional[OrdersUpdateRequestBody], Field(description="Specify the parameters of the order that are to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrdersUpdateResponseBody]: + """Update Order + + Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged. + + :param order_id: Unique Voucherify order ID or order source ID. (required) + :type order_id: str + :param orders_update_request_body: Specify the parameters of the order that are to be updated. + :type orders_update_request_body: OrdersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_order_serialize( + order_id=order_id, + orders_update_request_body=orders_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_order_without_preload_content( + self, + order_id: Annotated[StrictStr, Field(description="Unique Voucherify order ID or order source ID.")], + orders_update_request_body: Annotated[Optional[OrdersUpdateRequestBody], Field(description="Specify the parameters of the order that are to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Order + + Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged. + + :param order_id: Unique Voucherify order ID or order source ID. (required) + :type order_id: str + :param orders_update_request_body: Specify the parameters of the order that are to be updated. + :type orders_update_request_body: OrdersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_order_serialize( + order_id=order_id, + orders_update_request_body=orders_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "OrdersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_order_serialize( + self, + order_id, + orders_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if order_id is not None: + _path_params['orderId'] = order_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if orders_update_request_body is not None: + _body_params = orders_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/orders/{orderId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/product_collections_api.py b/voucherify/api/product_collections_api.py new file mode 100644 index 00000000..08fe3161 --- /dev/null +++ b/voucherify/api/product_collections_api.py @@ -0,0 +1,1465 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from datetime import datetime +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.product_collections_create_request_body import ProductCollectionsCreateRequestBody +from voucherify.models.product_collections_create_response_body import ProductCollectionsCreateResponseBody +from voucherify.models.product_collections_get_response_body import ProductCollectionsGetResponseBody +from voucherify.models.product_collections_list_response_body import ProductCollectionsListResponseBody +from voucherify.models.product_collections_products_list_response_body import ProductCollectionsProductsListResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class ProductCollectionsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_product_collection( + self, + product_collections_create_request_body: Optional[ProductCollectionsCreateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductCollectionsCreateResponseBody: + """Create Product Collection + + This method creates a new product collection. + + :param product_collections_create_request_body: + :type product_collections_create_request_body: ProductCollectionsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_product_collection_serialize( + product_collections_create_request_body=product_collections_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_product_collection_with_http_info( + self, + product_collections_create_request_body: Optional[ProductCollectionsCreateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductCollectionsCreateResponseBody]: + """Create Product Collection + + This method creates a new product collection. + + :param product_collections_create_request_body: + :type product_collections_create_request_body: ProductCollectionsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_product_collection_serialize( + product_collections_create_request_body=product_collections_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_product_collection_without_preload_content( + self, + product_collections_create_request_body: Optional[ProductCollectionsCreateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Product Collection + + This method creates a new product collection. + + :param product_collections_create_request_body: + :type product_collections_create_request_body: ProductCollectionsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_product_collection_serialize( + product_collections_create_request_body=product_collections_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_product_collection_serialize( + self, + product_collections_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if product_collections_create_request_body is not None: + _body_params = product_collections_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/product-collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_product_collection( + self, + product_collection_id: Annotated[StrictStr, Field(description="A unique product collection ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Product Collection + + This method deletes a product collection. + + :param product_collection_id: A unique product collection ID. (required) + :type product_collection_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_product_collection_serialize( + product_collection_id=product_collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_product_collection_with_http_info( + self, + product_collection_id: Annotated[StrictStr, Field(description="A unique product collection ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Product Collection + + This method deletes a product collection. + + :param product_collection_id: A unique product collection ID. (required) + :type product_collection_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_product_collection_serialize( + product_collection_id=product_collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_product_collection_without_preload_content( + self, + product_collection_id: Annotated[StrictStr, Field(description="A unique product collection ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Product Collection + + This method deletes a product collection. + + :param product_collection_id: A unique product collection ID. (required) + :type product_collection_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_product_collection_serialize( + product_collection_id=product_collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_product_collection_serialize( + self, + product_collection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_collection_id is not None: + _path_params['productCollectionId'] = product_collection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/product-collections/{productCollectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_product_collection( + self, + product_collection_id: Annotated[StrictStr, Field(description="A unique product collection ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductCollectionsGetResponseBody: + """Get Product Collection + + Retrieves the product collection. + + :param product_collection_id: A unique product collection ID. (required) + :type product_collection_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_collection_serialize( + product_collection_id=product_collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_product_collection_with_http_info( + self, + product_collection_id: Annotated[StrictStr, Field(description="A unique product collection ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductCollectionsGetResponseBody]: + """Get Product Collection + + Retrieves the product collection. + + :param product_collection_id: A unique product collection ID. (required) + :type product_collection_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_collection_serialize( + product_collection_id=product_collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_product_collection_without_preload_content( + self, + product_collection_id: Annotated[StrictStr, Field(description="A unique product collection ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Product Collection + + Retrieves the product collection. + + :param product_collection_id: A unique product collection ID. (required) + :type product_collection_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_collection_serialize( + product_collection_id=product_collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_product_collection_serialize( + self, + product_collection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_collection_id is not None: + _path_params['productCollectionId'] = product_collection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/product-collections/{productCollectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_product_collections( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductCollectionsListResponseBody: + """List Product Collections + + This method returns a list of product collections. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_product_collections_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_product_collections_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductCollectionsListResponseBody]: + """List Product Collections + + This method returns a list of product collections. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_product_collections_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_product_collections_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Product Collections + + This method returns a list of product collections. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_product_collections_serialize( + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_product_collections_serialize( + self, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/product-collections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_products_in_collection( + self, + product_collection_id: Annotated[StrictStr, Field(description="Unique product collection ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductCollectionsProductsListResponseBody: + """List Products in Collection + + Retrieves list of products from a product collection; works for both dynamic and static product collections. + + :param product_collection_id: Unique product collection ID. (required) + :type product_collection_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param starting_after: Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. + :type starting_after: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_products_in_collection_serialize( + product_collection_id=product_collection_id, + limit=limit, + page=page, + order=order, + starting_after=starting_after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsProductsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_products_in_collection_with_http_info( + self, + product_collection_id: Annotated[StrictStr, Field(description="Unique product collection ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductCollectionsProductsListResponseBody]: + """List Products in Collection + + Retrieves list of products from a product collection; works for both dynamic and static product collections. + + :param product_collection_id: Unique product collection ID. (required) + :type product_collection_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param starting_after: Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. + :type starting_after: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_products_in_collection_serialize( + product_collection_id=product_collection_id, + limit=limit, + page=page, + order=order, + starting_after=starting_after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsProductsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_products_in_collection_without_preload_content( + self, + product_collection_id: Annotated[StrictStr, Field(description="Unique product collection ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Products in Collection + + Retrieves list of products from a product collection; works for both dynamic and static product collections. + + :param product_collection_id: Unique product collection ID. (required) + :type product_collection_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param starting_after: Timestamp representing the date and time to use in starting_after cursor to get more data. Represented in ISO 8601 format. + :type starting_after: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_products_in_collection_serialize( + product_collection_id=product_collection_id, + limit=limit, + page=page, + order=order, + starting_after=starting_after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductCollectionsProductsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_products_in_collection_serialize( + self, + product_collection_id, + limit, + page, + order, + starting_after, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_collection_id is not None: + _path_params['productCollectionId'] = product_collection_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after is not None: + if isinstance(starting_after, datetime): + _query_params.append( + ( + 'starting_after', + starting_after.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('starting_after', starting_after)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/product-collections/{productCollectionId}/products', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/products_api.py b/voucherify/api/products_api.py new file mode 100644 index 00000000..84acb252 --- /dev/null +++ b/voucherify/api/products_api.py @@ -0,0 +1,4090 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from datetime import datetime +from pydantic import Field, StrictBool, StrictBytes, StrictStr +from typing import List, Optional, Union +from typing_extensions import Annotated +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.products_create_request_body import ProductsCreateRequestBody +from voucherify.models.products_create_response_body import ProductsCreateResponseBody +from voucherify.models.products_get_response_body import ProductsGetResponseBody +from voucherify.models.products_import_csv_create_response_body import ProductsImportCsvCreateResponseBody +from voucherify.models.products_list_response_body import ProductsListResponseBody +from voucherify.models.products_metadata_update_in_bulk_request_body import ProductsMetadataUpdateInBulkRequestBody +from voucherify.models.products_metadata_update_in_bulk_response_body import ProductsMetadataUpdateInBulkResponseBody +from voucherify.models.products_skus_create_request_body import ProductsSkusCreateRequestBody +from voucherify.models.products_skus_create_response_body import ProductsSkusCreateResponseBody +from voucherify.models.products_skus_list_response_body import ProductsSkusListResponseBody +from voucherify.models.products_skus_update_request_body import ProductsSkusUpdateRequestBody +from voucherify.models.products_skus_update_response_body import ProductsSkusUpdateResponseBody +from voucherify.models.products_update_in_bulk_request_body import ProductsUpdateInBulkRequestBody +from voucherify.models.products_update_in_bulk_response_body import ProductsUpdateInBulkResponseBody +from voucherify.models.products_update_request_body import ProductsUpdateRequestBody +from voucherify.models.products_update_response_body import ProductsUpdateResponseBody +from voucherify.models.skus_get_response_body import SkusGetResponseBody +from voucherify.models.skus_import_csv_create_response_body import SkusImportCsvCreateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class ProductsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_product( + self, + products_create_request_body: Annotated[Optional[ProductsCreateRequestBody], Field(description="Specify the product parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsCreateResponseBody: + """Create Product + + Creates a product object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the product database, Voucherify will return a related product object with updated fields. + + :param products_create_request_body: Specify the product parameters. + :type products_create_request_body: ProductsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_product_serialize( + products_create_request_body=products_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_product_with_http_info( + self, + products_create_request_body: Annotated[Optional[ProductsCreateRequestBody], Field(description="Specify the product parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsCreateResponseBody]: + """Create Product + + Creates a product object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the product database, Voucherify will return a related product object with updated fields. + + :param products_create_request_body: Specify the product parameters. + :type products_create_request_body: ProductsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_product_serialize( + products_create_request_body=products_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_product_without_preload_content( + self, + products_create_request_body: Annotated[Optional[ProductsCreateRequestBody], Field(description="Specify the product parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Product + + Creates a product object. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the product database, Voucherify will return a related product object with updated fields. + + :param products_create_request_body: Specify the product parameters. + :type products_create_request_body: ProductsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_product_serialize( + products_create_request_body=products_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_product_serialize( + self, + products_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if products_create_request_body is not None: + _body_params = products_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/products', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_sku( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or product source ID.")], + products_skus_create_request_body: Annotated[Optional[ProductsSkusCreateRequestBody], Field(description="Specify the SKU parameters to be created.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsSkusCreateResponseBody: + """Create SKU + + This method adds product variants to a created product. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the sku database, Voucherify will return a related sku object with updated fields. + + :param product_id: A Voucherify product ID or product source ID. (required) + :type product_id: str + :param products_skus_create_request_body: Specify the SKU parameters to be created. + :type products_skus_create_request_body: ProductsSkusCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_sku_serialize( + product_id=product_id, + products_skus_create_request_body=products_skus_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_sku_with_http_info( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or product source ID.")], + products_skus_create_request_body: Annotated[Optional[ProductsSkusCreateRequestBody], Field(description="Specify the SKU parameters to be created.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsSkusCreateResponseBody]: + """Create SKU + + This method adds product variants to a created product. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the sku database, Voucherify will return a related sku object with updated fields. + + :param product_id: A Voucherify product ID or product source ID. (required) + :type product_id: str + :param products_skus_create_request_body: Specify the SKU parameters to be created. + :type products_skus_create_request_body: ProductsSkusCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_sku_serialize( + product_id=product_id, + products_skus_create_request_body=products_skus_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_sku_without_preload_content( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or product source ID.")], + products_skus_create_request_body: Annotated[Optional[ProductsSkusCreateRequestBody], Field(description="Specify the SKU parameters to be created.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create SKU + + This method adds product variants to a created product. ๐Ÿ“˜ Upsert Mode If you pass an id or a source_id that already exists in the sku database, Voucherify will return a related sku object with updated fields. + + :param product_id: A Voucherify product ID or product source ID. (required) + :type product_id: str + :param products_skus_create_request_body: Specify the SKU parameters to be created. + :type products_skus_create_request_body: ProductsSkusCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_sku_serialize( + product_id=product_id, + products_skus_create_request_body=products_skus_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_sku_serialize( + self, + product_id, + products_skus_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_id is not None: + _path_params['productId'] = product_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if products_skus_create_request_body is not None: + _body_params = products_skus_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/products/{productId}/skus', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_product( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Product + + Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: str + :param force: If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_product_serialize( + product_id=product_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_product_with_http_info( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Product + + Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: str + :param force: If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_product_serialize( + product_id=product_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_product_without_preload_content( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Product + + Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: str + :param force: If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_product_serialize( + product_id=product_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_product_serialize( + self, + product_id, + force, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_id is not None: + _path_params['productId'] = product_id + # process the query parameters + if force is not None: + + _query_params.append(('force', force)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/products/{productId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_sku( + self, + product_id: Annotated[StrictStr, Field(description="A unique Voucherify product ID or product source ID.")], + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU ID or SKU source ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete SKU + + Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. + + :param product_id: A unique Voucherify product ID or product source ID. (required) + :type product_id: str + :param sku_id: A Voucherify SKU ID or SKU source ID. (required) + :type sku_id: str + :param force: If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_sku_serialize( + product_id=product_id, + sku_id=sku_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_sku_with_http_info( + self, + product_id: Annotated[StrictStr, Field(description="A unique Voucherify product ID or product source ID.")], + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU ID or SKU source ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete SKU + + Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. + + :param product_id: A unique Voucherify product ID or product source ID. (required) + :type product_id: str + :param sku_id: A Voucherify SKU ID or SKU source ID. (required) + :type sku_id: str + :param force: If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_sku_serialize( + product_id=product_id, + sku_id=sku_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_sku_without_preload_content( + self, + product_id: Annotated[StrictStr, Field(description="A unique Voucherify product ID or product source ID.")], + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU ID or SKU source ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete SKU + + Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. + + :param product_id: A unique Voucherify product ID or product source ID. (required) + :type product_id: str + :param sku_id: A Voucherify SKU ID or SKU source ID. (required) + :type sku_id: str + :param force: If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_sku_serialize( + product_id=product_id, + sku_id=sku_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_sku_serialize( + self, + product_id, + sku_id, + force, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_id is not None: + _path_params['productId'] = product_id + if sku_id is not None: + _path_params['skuId'] = sku_id + # process the query parameters + if force is not None: + + _query_params.append(('force', force)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/products/{productId}/skus/{skuId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_product( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsGetResponseBody: + """Get Product + + Retrieve product details. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_serialize( + product_id=product_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_product_with_http_info( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsGetResponseBody]: + """Get Product + + Retrieve product details. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_serialize( + product_id=product_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_product_without_preload_content( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Product + + Retrieve product details. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_serialize( + product_id=product_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_product_serialize( + self, + product_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_id is not None: + _path_params['productId'] = product_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/products/{productId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_sku( + self, + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU identifier or SKU source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SkusGetResponseBody: + """Get SKU + + Retrieve details of a SKU. + + :param sku_id: A Voucherify SKU identifier or SKU source ID. (required) + :type sku_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_sku_serialize( + sku_id=sku_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SkusGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_sku_with_http_info( + self, + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU identifier or SKU source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SkusGetResponseBody]: + """Get SKU + + Retrieve details of a SKU. + + :param sku_id: A Voucherify SKU identifier or SKU source ID. (required) + :type sku_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_sku_serialize( + sku_id=sku_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SkusGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_sku_without_preload_content( + self, + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU identifier or SKU source ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get SKU + + Retrieve details of a SKU. + + :param sku_id: A Voucherify SKU identifier or SKU source ID. (required) + :type sku_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_sku_serialize( + sku_id=sku_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SkusGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_sku_serialize( + self, + sku_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sku_id is not None: + _path_params['skuId'] = sku_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/skus/{skuId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_products_using_csv( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsImportCsvCreateResponseBody: + """Import Products using CSV + + Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_products_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_products_using_csv_with_http_info( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsImportCsvCreateResponseBody]: + """Import Products using CSV + + Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_products_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_products_using_csv_without_preload_content( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import Products using CSV + + Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_products_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_products_using_csv_serialize( + self, + file, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/products/importCSV', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_skus_using_csv( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SkusImportCsvCreateResponseBody: + """Import SKUs using CSV + + Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_skus_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SkusImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_skus_using_csv_with_http_info( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SkusImportCsvCreateResponseBody]: + """Import SKUs using CSV + + Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_skus_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SkusImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_skus_using_csv_without_preload_content( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import SKUs using CSV + + Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_skus_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SkusImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_skus_using_csv_serialize( + self, + file, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/skus/importCSV', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_products( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsListResponseBody: + """List Products + + Retrieve a list of products. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param start_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_products_serialize( + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_products_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsListResponseBody]: + """List Products + + Retrieve a list of products. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param start_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_products_serialize( + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_products_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Products + + Retrieve a list of products. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param start_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_products_serialize( + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_products_serialize( + self, + limit, + page, + order, + start_date, + end_date, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if start_date is not None: + if isinstance(start_date, datetime): + _query_params.append( + ( + 'start_date', + start_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('start_date', start_date)) + + if end_date is not None: + if isinstance(end_date, datetime): + _query_params.append( + ( + 'end_date', + end_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('end_date', end_date)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/products', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_skus_in_product( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or product source ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsSkusListResponseBody: + """List SKUs in Product + + Retrieve all SKUs for a given product. + + :param product_id: A Voucherify product ID or product source ID. (required) + :type product_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param start_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_skus_in_product_serialize( + product_id=product_id, + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_skus_in_product_with_http_info( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or product source ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsSkusListResponseBody]: + """List SKUs in Product + + Retrieve all SKUs for a given product. + + :param product_id: A Voucherify product ID or product source ID. (required) + :type product_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param start_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_skus_in_product_serialize( + product_id=product_id, + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_skus_in_product_without_preload_content( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or product source ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrder], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List SKUs in Product + + Retrieve all SKUs for a given product. + + :param product_id: A Voucherify product ID or product source ID. (required) + :type product_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrder + :param start_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_skus_in_product_serialize( + product_id=product_id, + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_skus_in_product_serialize( + self, + product_id, + limit, + page, + order, + start_date, + end_date, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_id is not None: + _path_params['productId'] = product_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if start_date is not None: + if isinstance(start_date, datetime): + _query_params.append( + ( + 'start_date', + start_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('start_date', start_date)) + + if end_date is not None: + if isinstance(end_date, datetime): + _query_params.append( + ( + 'end_date', + end_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('end_date', end_date)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/products/{productId}/skus', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_product( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + products_update_request_body: Annotated[Optional[ProductsUpdateRequestBody], Field(description="Specify the parameters of the product that are to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsUpdateResponseBody: + """Update Product + + Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: str + :param products_update_request_body: Specify the parameters of the product that are to be updated. + :type products_update_request_body: ProductsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_product_serialize( + product_id=product_id, + products_update_request_body=products_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_product_with_http_info( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + products_update_request_body: Annotated[Optional[ProductsUpdateRequestBody], Field(description="Specify the parameters of the product that are to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsUpdateResponseBody]: + """Update Product + + Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: str + :param products_update_request_body: Specify the parameters of the product that are to be updated. + :type products_update_request_body: ProductsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_product_serialize( + product_id=product_id, + products_update_request_body=products_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_product_without_preload_content( + self, + product_id: Annotated[StrictStr, Field(description="A Voucherify product ID or source ID.")], + products_update_request_body: Annotated[Optional[ProductsUpdateRequestBody], Field(description="Specify the parameters of the product that are to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Product + + Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. + + :param product_id: A Voucherify product ID or source ID. (required) + :type product_id: str + :param products_update_request_body: Specify the parameters of the product that are to be updated. + :type products_update_request_body: ProductsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_product_serialize( + product_id=product_id, + products_update_request_body=products_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_product_serialize( + self, + product_id, + products_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_id is not None: + _path_params['productId'] = product_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if products_update_request_body is not None: + _body_params = products_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/products/{productId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_products_in_bulk( + self, + products_update_in_bulk_request_body: Annotated[Optional[List[ProductsUpdateInBulkRequestBody]], Field(description="List the product fields to be updated in each customer object.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsUpdateInBulkResponseBody: + """Update Products in Bulk + + Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param products_update_in_bulk_request_body: List the product fields to be updated in each customer object. + :type products_update_in_bulk_request_body: List[ProductsUpdateInBulkRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_products_in_bulk_serialize( + products_update_in_bulk_request_body=products_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_products_in_bulk_with_http_info( + self, + products_update_in_bulk_request_body: Annotated[Optional[List[ProductsUpdateInBulkRequestBody]], Field(description="List the product fields to be updated in each customer object.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsUpdateInBulkResponseBody]: + """Update Products in Bulk + + Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param products_update_in_bulk_request_body: List the product fields to be updated in each customer object. + :type products_update_in_bulk_request_body: List[ProductsUpdateInBulkRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_products_in_bulk_serialize( + products_update_in_bulk_request_body=products_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_products_in_bulk_without_preload_content( + self, + products_update_in_bulk_request_body: Annotated[Optional[List[ProductsUpdateInBulkRequestBody]], Field(description="List the product fields to be updated in each customer object.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Products in Bulk + + Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param products_update_in_bulk_request_body: List the product fields to be updated in each customer object. + :type products_update_in_bulk_request_body: List[ProductsUpdateInBulkRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_products_in_bulk_serialize( + products_update_in_bulk_request_body=products_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_products_in_bulk_serialize( + self, + products_update_in_bulk_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'ProductsUpdateInBulkRequestBody': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if products_update_in_bulk_request_body is not None: + _body_params = products_update_in_bulk_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/products/bulk/async', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_products_metadata_in_bulk( + self, + products_metadata_update_in_bulk_request_body: Annotated[Optional[ProductsMetadataUpdateInBulkRequestBody], Field(description="List the source_ids of the products you would like to update with the metadata key/value pairs.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsMetadataUpdateInBulkResponseBody: + """Update Products' Metadata in Bulk + + Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param products_metadata_update_in_bulk_request_body: List the source_ids of the products you would like to update with the metadata key/value pairs. + :type products_metadata_update_in_bulk_request_body: ProductsMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_products_metadata_in_bulk_serialize( + products_metadata_update_in_bulk_request_body=products_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_products_metadata_in_bulk_with_http_info( + self, + products_metadata_update_in_bulk_request_body: Annotated[Optional[ProductsMetadataUpdateInBulkRequestBody], Field(description="List the source_ids of the products you would like to update with the metadata key/value pairs.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsMetadataUpdateInBulkResponseBody]: + """Update Products' Metadata in Bulk + + Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param products_metadata_update_in_bulk_request_body: List the source_ids of the products you would like to update with the metadata key/value pairs. + :type products_metadata_update_in_bulk_request_body: ProductsMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_products_metadata_in_bulk_serialize( + products_metadata_update_in_bulk_request_body=products_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_products_metadata_in_bulk_without_preload_content( + self, + products_metadata_update_in_bulk_request_body: Annotated[Optional[ProductsMetadataUpdateInBulkRequestBody], Field(description="List the source_ids of the products you would like to update with the metadata key/value pairs.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Products' Metadata in Bulk + + Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is **upserted**. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param products_metadata_update_in_bulk_request_body: List the source_ids of the products you would like to update with the metadata key/value pairs. + :type products_metadata_update_in_bulk_request_body: ProductsMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_products_metadata_in_bulk_serialize( + products_metadata_update_in_bulk_request_body=products_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_products_metadata_in_bulk_serialize( + self, + products_metadata_update_in_bulk_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if products_metadata_update_in_bulk_request_body is not None: + _body_params = products_metadata_update_in_bulk_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/products/metadata/async', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_sku( + self, + product_id: Annotated[StrictStr, Field(description="A unique Voucherify product ID or product source ID.")], + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU ID or SKU source ID.")], + products_skus_update_request_body: Annotated[Optional[ProductsSkusUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductsSkusUpdateResponseBody: + """Update SKU + + Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body schema wont be modified. Even if provided, they will be silently skipped. + + :param product_id: A unique Voucherify product ID or product source ID. (required) + :type product_id: str + :param sku_id: A Voucherify SKU ID or SKU source ID. (required) + :type sku_id: str + :param products_skus_update_request_body: Specify the parameters to be updated. + :type products_skus_update_request_body: ProductsSkusUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_sku_serialize( + product_id=product_id, + sku_id=sku_id, + products_skus_update_request_body=products_skus_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_sku_with_http_info( + self, + product_id: Annotated[StrictStr, Field(description="A unique Voucherify product ID or product source ID.")], + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU ID or SKU source ID.")], + products_skus_update_request_body: Annotated[Optional[ProductsSkusUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductsSkusUpdateResponseBody]: + """Update SKU + + Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body schema wont be modified. Even if provided, they will be silently skipped. + + :param product_id: A unique Voucherify product ID or product source ID. (required) + :type product_id: str + :param sku_id: A Voucherify SKU ID or SKU source ID. (required) + :type sku_id: str + :param products_skus_update_request_body: Specify the parameters to be updated. + :type products_skus_update_request_body: ProductsSkusUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_sku_serialize( + product_id=product_id, + sku_id=sku_id, + products_skus_update_request_body=products_skus_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_sku_without_preload_content( + self, + product_id: Annotated[StrictStr, Field(description="A unique Voucherify product ID or product source ID.")], + sku_id: Annotated[StrictStr, Field(description="A Voucherify SKU ID or SKU source ID.")], + products_skus_update_request_body: Annotated[Optional[ProductsSkusUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update SKU + + Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body schema wont be modified. Even if provided, they will be silently skipped. + + :param product_id: A unique Voucherify product ID or product source ID. (required) + :type product_id: str + :param sku_id: A Voucherify SKU ID or SKU source ID. (required) + :type sku_id: str + :param products_skus_update_request_body: Specify the parameters to be updated. + :type products_skus_update_request_body: ProductsSkusUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_sku_serialize( + product_id=product_id, + sku_id=sku_id, + products_skus_update_request_body=products_skus_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ProductsSkusUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_sku_serialize( + self, + product_id, + sku_id, + products_skus_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if product_id is not None: + _path_params['productId'] = product_id + if sku_id is not None: + _path_params['skuId'] = sku_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if products_skus_update_request_body is not None: + _body_params = products_skus_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/products/{productId}/skus/{skuId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/promotions_api.py b/voucherify/api/promotions_api.py new file mode 100644 index 00000000..d4791cc2 --- /dev/null +++ b/voucherify/api/promotions_api.py @@ -0,0 +1,3963 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_order_list_all_promotion_stacks import ParameterOrderListAllPromotionStacks +from voucherify.models.parameter_order_list_promotion_tiers import ParameterOrderListPromotionTiers +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter +from voucherify.models.promotions_stacks_create_request_body import PromotionsStacksCreateRequestBody +from voucherify.models.promotions_stacks_create_response_body import PromotionsStacksCreateResponseBody +from voucherify.models.promotions_stacks_get_response_body import PromotionsStacksGetResponseBody +from voucherify.models.promotions_stacks_list_response_body import PromotionsStacksListResponseBody +from voucherify.models.promotions_stacks_update_request_body import PromotionsStacksUpdateRequestBody +from voucherify.models.promotions_stacks_update_response_body import PromotionsStacksUpdateResponseBody +from voucherify.models.promotions_tiers_create_request_body import PromotionsTiersCreateRequestBody +from voucherify.models.promotions_tiers_create_response_body import PromotionsTiersCreateResponseBody +from voucherify.models.promotions_tiers_disable_response_body import PromotionsTiersDisableResponseBody +from voucherify.models.promotions_tiers_enable_response_body import PromotionsTiersEnableResponseBody +from voucherify.models.promotions_tiers_get_response_body import PromotionsTiersGetResponseBody +from voucherify.models.promotions_tiers_list_response_body import PromotionsTiersListResponseBody +from voucherify.models.promotions_tiers_update_request_body import PromotionsTiersUpdateRequestBody +from voucherify.models.promotions_tiers_update_response_body import PromotionsTiersUpdateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class PromotionsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def add_promotion_tier_to_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID assigned by Voucherify.")], + promotions_tiers_create_request_body: Annotated[Optional[PromotionsTiersCreateRequestBody], Field(description="Specify the promotion tier parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsTiersCreateResponseBody: + """Add Promotion Tier to Campaign + + This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + + :param campaign_id: Unique campaign ID assigned by Voucherify. (required) + :type campaign_id: str + :param promotions_tiers_create_request_body: Specify the promotion tier parameters. + :type promotions_tiers_create_request_body: PromotionsTiersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_promotion_tier_to_campaign_serialize( + campaign_id=campaign_id, + promotions_tiers_create_request_body=promotions_tiers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def add_promotion_tier_to_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID assigned by Voucherify.")], + promotions_tiers_create_request_body: Annotated[Optional[PromotionsTiersCreateRequestBody], Field(description="Specify the promotion tier parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsTiersCreateResponseBody]: + """Add Promotion Tier to Campaign + + This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + + :param campaign_id: Unique campaign ID assigned by Voucherify. (required) + :type campaign_id: str + :param promotions_tiers_create_request_body: Specify the promotion tier parameters. + :type promotions_tiers_create_request_body: PromotionsTiersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_promotion_tier_to_campaign_serialize( + campaign_id=campaign_id, + promotions_tiers_create_request_body=promotions_tiers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def add_promotion_tier_to_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID assigned by Voucherify.")], + promotions_tiers_create_request_body: Annotated[Optional[PromotionsTiersCreateRequestBody], Field(description="Specify the promotion tier parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add Promotion Tier to Campaign + + This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier. + + :param campaign_id: Unique campaign ID assigned by Voucherify. (required) + :type campaign_id: str + :param promotions_tiers_create_request_body: Specify the promotion tier parameters. + :type promotions_tiers_create_request_body: PromotionsTiersCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_promotion_tier_to_campaign_serialize( + campaign_id=campaign_id, + promotions_tiers_create_request_body=promotions_tiers_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_promotion_tier_to_campaign_serialize( + self, + campaign_id, + promotions_tiers_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if promotions_tiers_create_request_body is not None: + _body_params = promotions_tiers_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/promotions/{campaignId}/tiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_promotion_stack( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + promotions_stacks_create_request_body: Annotated[Optional[PromotionsStacksCreateRequestBody], Field(description="Specify the order of promotion tiers for the promotion stack.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsStacksCreateResponseBody: + """Create Promotion Stack + + This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param promotions_stacks_create_request_body: Specify the order of promotion tiers for the promotion stack. + :type promotions_stacks_create_request_body: PromotionsStacksCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_promotion_stack_serialize( + campaign_id=campaign_id, + promotions_stacks_create_request_body=promotions_stacks_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_promotion_stack_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + promotions_stacks_create_request_body: Annotated[Optional[PromotionsStacksCreateRequestBody], Field(description="Specify the order of promotion tiers for the promotion stack.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsStacksCreateResponseBody]: + """Create Promotion Stack + + This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param promotions_stacks_create_request_body: Specify the order of promotion tiers for the promotion stack. + :type promotions_stacks_create_request_body: PromotionsStacksCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_promotion_stack_serialize( + campaign_id=campaign_id, + promotions_stacks_create_request_body=promotions_stacks_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_promotion_stack_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + promotions_stacks_create_request_body: Annotated[Optional[PromotionsStacksCreateRequestBody], Field(description="Specify the order of promotion tiers for the promotion stack.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Promotion Stack + + This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: str + :param promotions_stacks_create_request_body: Specify the order of promotion tiers for the promotion stack. + :type promotions_stacks_create_request_body: PromotionsStacksCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_promotion_stack_serialize( + campaign_id=campaign_id, + promotions_stacks_create_request_body=promotions_stacks_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_promotion_stack_serialize( + self, + campaign_id, + promotions_stacks_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if promotions_stacks_create_request_body is not None: + _body_params = promotions_stacks_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/promotions/{campaignId}/stacks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_promotion_stack( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Promotion Stack + + This method deletes a promotion stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_promotion_stack_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Promotion Stack + + This method deletes a promotion stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_promotion_stack_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Promotion Stack + + This method deletes a promotion stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_promotion_stack_serialize( + self, + campaign_id, + stack_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if stack_id is not None: + _path_params['stackId'] = stack_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/promotions/{campaignId}/stacks/{stackId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_promotion_tier( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Promotion Tier + + This method deletes a promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_promotion_tier_with_http_info( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Promotion Tier + + This method deletes a promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_promotion_tier_without_preload_content( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Promotion Tier + + This method deletes a promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_promotion_tier_serialize( + self, + promotion_tier_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if promotion_tier_id is not None: + _path_params['promotionTierId'] = promotion_tier_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/promotions/tiers/{promotionTierId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def disable_promotion_tier( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsTiersDisableResponseBody: + """Disable Promotion Tier + + This method disables a promotion tier, i.e. makes the active parameter false. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def disable_promotion_tier_with_http_info( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsTiersDisableResponseBody]: + """Disable Promotion Tier + + This method disables a promotion tier, i.e. makes the active parameter false. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def disable_promotion_tier_without_preload_content( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disable Promotion Tier + + This method disables a promotion tier, i.e. makes the active parameter false. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _disable_promotion_tier_serialize( + self, + promotion_tier_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if promotion_tier_id is not None: + _path_params['promotionTierId'] = promotion_tier_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/promotions/tiers/{promotionTierId}/disable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def enable_promotion_tier( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsTiersEnableResponseBody: + """Enable Promotion Tier + + This method enables a promotion tier, i.e. makes the active parameter true. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def enable_promotion_tier_with_http_info( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsTiersEnableResponseBody]: + """Enable Promotion Tier + + This method enables a promotion tier, i.e. makes the active parameter true. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def enable_promotion_tier_without_preload_content( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enable Promotion Tier + + This method enables a promotion tier, i.e. makes the active parameter true. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _enable_promotion_tier_serialize( + self, + promotion_tier_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if promotion_tier_id is not None: + _path_params['promotionTierId'] = promotion_tier_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/promotions/tiers/{promotionTierId}/enable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_promotion_stack( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsStacksGetResponseBody: + """Get Promotion Stack + + This method returns the details of a promotion stack, including the promotion tiers grouped within the stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_promotion_stack_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsStacksGetResponseBody]: + """Get Promotion Stack + + This method returns the details of a promotion stack, including the promotion tiers grouped within the stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_promotion_stack_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Promotion Stack + + This method returns the details of a promotion stack, including the promotion tiers grouped within the stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_promotion_stack_serialize( + self, + campaign_id, + stack_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if stack_id is not None: + _path_params['stackId'] = stack_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/promotions/{campaignId}/stacks/{stackId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_promotion_tier( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsTiersGetResponseBody: + """Get Promotion Tier + + This method enables you to retrieve a specific promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_promotion_tier_with_http_info( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsTiersGetResponseBody]: + """Get Promotion Tier + + This method enables you to retrieve a specific promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_promotion_tier_without_preload_content( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Promotion Tier + + This method enables you to retrieve a specific promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_promotion_tier_serialize( + self, + promotion_tier_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if promotion_tier_id is not None: + _path_params['promotionTierId'] = promotion_tier_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/promotions/tiers/{promotionTierId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_all_promotion_stacks( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListAllPromotionStacks], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsStacksListResponseBody: + """List Promotion Stacks + + This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListAllPromotionStacks + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_all_promotion_stacks_serialize( + limit=limit, + page=page, + order=order, + created_at=created_at, + updated_at=updated_at, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_all_promotion_stacks_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListAllPromotionStacks], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsStacksListResponseBody]: + """List Promotion Stacks + + This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListAllPromotionStacks + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_all_promotion_stacks_serialize( + limit=limit, + page=page, + order=order, + created_at=created_at, + updated_at=updated_at, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_all_promotion_stacks_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListAllPromotionStacks], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Promotion Stacks + + This method enables you to list promotion stacks irrespective of the campaign they are associated with. You can use filters in the query parameters to specify the stacks to be returned in the response. # Advanced filters for fetching promotion stacks + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListAllPromotionStacks + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_all_promotion_stacks_serialize( + limit=limit, + page=page, + order=order, + created_at=created_at, + updated_at=updated_at, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_all_promotion_stacks_serialize( + self, + limit, + page, + order, + created_at, + updated_at, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if created_at is not None: + + _query_params.append(('created_at', created_at)) + + if updated_at is not None: + + _query_params.append(('updated_at', updated_at)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/promotions/stacks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_promotion_stacks_in_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsStacksListResponseBody: + """List Promotion Stacks in Campaign + + This method enables you to list promotion stacks from a specified campaign. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_stacks_in_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_promotion_stacks_in_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsStacksListResponseBody]: + """List Promotion Stacks in Campaign + + This method enables you to list promotion stacks from a specified campaign. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_stacks_in_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_promotion_stacks_in_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Promotion Stacks in Campaign + + This method enables you to list promotion stacks from a specified campaign. + + :param campaign_id: Unique campaign ID. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_stacks_in_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_promotion_stacks_in_campaign_serialize( + self, + campaign_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/promotions/{campaignId}/stacks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_promotion_tiers( + self, + is_available: Annotated[Optional[StrictBool], Field(description="This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPromotionTiers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsTiersListResponseBody: + """List Promotion Tiers + + This method enables you to list promotion tiers. + + :param is_available: This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + :type is_available: bool + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPromotionTiers + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_serialize( + is_available=is_available, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_promotion_tiers_with_http_info( + self, + is_available: Annotated[Optional[StrictBool], Field(description="This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPromotionTiers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsTiersListResponseBody]: + """List Promotion Tiers + + This method enables you to list promotion tiers. + + :param is_available: This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + :type is_available: bool + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPromotionTiers + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_serialize( + is_available=is_available, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_promotion_tiers_without_preload_content( + self, + is_available: Annotated[Optional[StrictBool], Field(description="This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPromotionTiers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Promotion Tiers + + This method enables you to list promotion tiers. + + :param is_available: This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions. + :type is_available: bool + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPromotionTiers + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_serialize( + is_available=is_available, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_promotion_tiers_serialize( + self, + is_available, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if is_available is not None: + + _query_params.append(('is_available', is_available)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/promotions/tiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_promotion_tiers_from_campaign( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsTiersListResponseBody: + """List Promotion Tiers from Campaign + + This method enables you to list promotion tiers from a specified campaign. + + :param campaign_id: Unique campaign ID assigned by Voucherify. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_from_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_promotion_tiers_from_campaign_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsTiersListResponseBody]: + """List Promotion Tiers from Campaign + + This method enables you to list promotion tiers from a specified campaign. + + :param campaign_id: Unique campaign ID assigned by Voucherify. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_from_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_promotion_tiers_from_campaign_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="Unique campaign ID assigned by Voucherify.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Promotion Tiers from Campaign + + This method enables you to list promotion tiers from a specified campaign. + + :param campaign_id: Unique campaign ID assigned by Voucherify. (required) + :type campaign_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_promotion_tiers_from_campaign_serialize( + campaign_id=campaign_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_promotion_tiers_from_campaign_serialize( + self, + campaign_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/promotions/{campaignId}/tiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_promotion_stack( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + promotions_stacks_update_request_body: Annotated[Optional[PromotionsStacksUpdateRequestBody], Field(description="Specify the promotion stack parameters that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsStacksUpdateResponseBody: + """Update Promotion Stack + + This methods allows for editing an existing stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: str + :param promotions_stacks_update_request_body: Specify the promotion stack parameters that you would like to update. + :type promotions_stacks_update_request_body: PromotionsStacksUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + promotions_stacks_update_request_body=promotions_stacks_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_promotion_stack_with_http_info( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + promotions_stacks_update_request_body: Annotated[Optional[PromotionsStacksUpdateRequestBody], Field(description="Specify the promotion stack parameters that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsStacksUpdateResponseBody]: + """Update Promotion Stack + + This methods allows for editing an existing stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: str + :param promotions_stacks_update_request_body: Specify the promotion stack parameters that you would like to update. + :type promotions_stacks_update_request_body: PromotionsStacksUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + promotions_stacks_update_request_body=promotions_stacks_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_promotion_stack_without_preload_content( + self, + campaign_id: Annotated[StrictStr, Field(description="ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. ")], + stack_id: Annotated[StrictStr, Field(description="Promotion stack ID.")], + promotions_stacks_update_request_body: Annotated[Optional[PromotionsStacksUpdateRequestBody], Field(description="Specify the promotion stack parameters that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Promotion Stack + + This methods allows for editing an existing stack. + + :param campaign_id: ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty Campaign. (required) + :type campaign_id: str + :param stack_id: Promotion stack ID. (required) + :type stack_id: str + :param promotions_stacks_update_request_body: Specify the promotion stack parameters that you would like to update. + :type promotions_stacks_update_request_body: PromotionsStacksUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_promotion_stack_serialize( + campaign_id=campaign_id, + stack_id=stack_id, + promotions_stacks_update_request_body=promotions_stacks_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsStacksUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_promotion_stack_serialize( + self, + campaign_id, + stack_id, + promotions_stacks_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if campaign_id is not None: + _path_params['campaignId'] = campaign_id + if stack_id is not None: + _path_params['stackId'] = stack_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if promotions_stacks_update_request_body is not None: + _body_params = promotions_stacks_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/promotions/{campaignId}/stacks/{stackId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_promotion_tier( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + promotions_tiers_update_request_body: Annotated[Optional[PromotionsTiersUpdateRequestBody], Field(description="Specify the promotion tier parameters that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PromotionsTiersUpdateResponseBody: + """Update Promotion Tier + + This method updates a promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: str + :param promotions_tiers_update_request_body: Specify the promotion tier parameters that you would like to update. + :type promotions_tiers_update_request_body: PromotionsTiersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + promotions_tiers_update_request_body=promotions_tiers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_promotion_tier_with_http_info( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + promotions_tiers_update_request_body: Annotated[Optional[PromotionsTiersUpdateRequestBody], Field(description="Specify the promotion tier parameters that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PromotionsTiersUpdateResponseBody]: + """Update Promotion Tier + + This method updates a promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: str + :param promotions_tiers_update_request_body: Specify the promotion tier parameters that you would like to update. + :type promotions_tiers_update_request_body: PromotionsTiersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + promotions_tiers_update_request_body=promotions_tiers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_promotion_tier_without_preload_content( + self, + promotion_tier_id: Annotated[StrictStr, Field(description="Unique promotion tier ID.")], + promotions_tiers_update_request_body: Annotated[Optional[PromotionsTiersUpdateRequestBody], Field(description="Specify the promotion tier parameters that you would like to update.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Promotion Tier + + This method updates a promotion tier. + + :param promotion_tier_id: Unique promotion tier ID. (required) + :type promotion_tier_id: str + :param promotions_tiers_update_request_body: Specify the promotion tier parameters that you would like to update. + :type promotions_tiers_update_request_body: PromotionsTiersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_promotion_tier_serialize( + promotion_tier_id=promotion_tier_id, + promotions_tiers_update_request_body=promotions_tiers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PromotionsTiersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_promotion_tier_serialize( + self, + promotion_tier_id, + promotions_tiers_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if promotion_tier_id is not None: + _path_params['promotionTierId'] = promotion_tier_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if promotions_tiers_update_request_body is not None: + _body_params = promotions_tiers_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/promotions/tiers/{promotionTierId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/publications_api.py b/voucherify/api/publications_api.py new file mode 100644 index 00000000..4f807db4 --- /dev/null +++ b/voucherify/api/publications_api.py @@ -0,0 +1,1116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictStr +from typing import Any, Dict, Optional +from typing_extensions import Annotated +from voucherify.models.create_publication_campaign import CreatePublicationCampaign +from voucherify.models.customer import Customer +from voucherify.models.parameter_order_list_publications import ParameterOrderListPublications +from voucherify.models.parameter_result_list_publications import ParameterResultListPublications +from voucherify.models.parameter_voucher_type_list_publications import ParameterVoucherTypeListPublications +from voucherify.models.publications_create_request_body import PublicationsCreateRequestBody +from voucherify.models.publications_create_response_body import PublicationsCreateResponseBody +from voucherify.models.publications_list_response_body import PublicationsListResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class PublicationsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_publication( + self, + join_once: Annotated[Optional[StrictBool], Field(description="Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.")] = None, + publications_create_request_body: Annotated[Optional[PublicationsCreateRequestBody], Field(description="Specify the publication parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PublicationsCreateResponseBody: + """Create Publication + + This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. + + :param join_once: Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. + :type join_once: bool + :param publications_create_request_body: Specify the publication parameters. + :type publications_create_request_body: PublicationsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_publication_serialize( + join_once=join_once, + publications_create_request_body=publications_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_publication_with_http_info( + self, + join_once: Annotated[Optional[StrictBool], Field(description="Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.")] = None, + publications_create_request_body: Annotated[Optional[PublicationsCreateRequestBody], Field(description="Specify the publication parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PublicationsCreateResponseBody]: + """Create Publication + + This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. + + :param join_once: Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. + :type join_once: bool + :param publications_create_request_body: Specify the publication parameters. + :type publications_create_request_body: PublicationsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_publication_serialize( + join_once=join_once, + publications_create_request_body=publications_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_publication_without_preload_content( + self, + join_once: Annotated[Optional[StrictBool], Field(description="Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.")] = None, + publications_create_request_body: Annotated[Optional[PublicationsCreateRequestBody], Field(description="Specify the publication parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Publication + + This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. + + :param join_once: Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. + :type join_once: bool + :param publications_create_request_body: Specify the publication parameters. + :type publications_create_request_body: PublicationsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_publication_serialize( + join_once=join_once, + publications_create_request_body=publications_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_publication_serialize( + self, + join_once, + publications_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if join_once is not None: + + _query_params.append(('join_once', join_once)) + + # process the header parameters + # process the form parameters + # process the body parameter + if publications_create_request_body is not None: + _body_params = publications_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/publications', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_publication1( + self, + customer: Annotated[Customer, Field(description="Contains information about the customer to whom the publication was directed.")], + join_once: Annotated[Optional[StrictBool], Field(description="Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.")] = None, + voucher: Annotated[Optional[StrictStr], Field(description="Code of voucher being published.")] = None, + campaign: Annotated[Optional[CreatePublicationCampaign], Field(description="Create publication with campaign.")] = None, + source_id: Annotated[Optional[StrictStr], Field(description="The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request.")] = None, + metadata: Annotated[Optional[Dict[str, Dict[str, Any]]], Field(description="The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PublicationsCreateResponseBody: + """Create Publication + + This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. โ—๏ธ Limited access Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a dedicated endpoint. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. # Example Request โ—๏ธ Required Query param voucher OR campaign MUST be filled out. If you provide both, campaign param will be skipped. + + :param customer: Contains information about the customer to whom the publication was directed. (required) + :type customer: Customer + :param join_once: Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. + :type join_once: bool + :param voucher: Code of voucher being published. + :type voucher: str + :param campaign: Create publication with campaign. + :type campaign: CreatePublicationCampaign + :param source_id: The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. + :type source_id: str + :param metadata: The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. + :type metadata: object + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_publication1_serialize( + customer=customer, + join_once=join_once, + voucher=voucher, + campaign=campaign, + source_id=source_id, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_publication1_with_http_info( + self, + customer: Annotated[Customer, Field(description="Contains information about the customer to whom the publication was directed.")], + join_once: Annotated[Optional[StrictBool], Field(description="Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.")] = None, + voucher: Annotated[Optional[StrictStr], Field(description="Code of voucher being published.")] = None, + campaign: Annotated[Optional[CreatePublicationCampaign], Field(description="Create publication with campaign.")] = None, + source_id: Annotated[Optional[StrictStr], Field(description="The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request.")] = None, + metadata: Annotated[Optional[Dict[str, Dict[str, Any]]], Field(description="The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PublicationsCreateResponseBody]: + """Create Publication + + This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. โ—๏ธ Limited access Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a dedicated endpoint. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. # Example Request โ—๏ธ Required Query param voucher OR campaign MUST be filled out. If you provide both, campaign param will be skipped. + + :param customer: Contains information about the customer to whom the publication was directed. (required) + :type customer: Customer + :param join_once: Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. + :type join_once: bool + :param voucher: Code of voucher being published. + :type voucher: str + :param campaign: Create publication with campaign. + :type campaign: CreatePublicationCampaign + :param source_id: The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. + :type source_id: str + :param metadata: The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. + :type metadata: object + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_publication1_serialize( + customer=customer, + join_once=join_once, + voucher=voucher, + campaign=campaign, + source_id=source_id, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_publication1_without_preload_content( + self, + customer: Annotated[Customer, Field(description="Contains information about the customer to whom the publication was directed.")], + join_once: Annotated[Optional[StrictBool], Field(description="Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer.")] = None, + voucher: Annotated[Optional[StrictStr], Field(description="Code of voucher being published.")] = None, + campaign: Annotated[Optional[CreatePublicationCampaign], Field(description="Create publication with campaign.")] = None, + source_id: Annotated[Optional[StrictStr], Field(description="The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request.")] = None, + metadata: Annotated[Optional[Dict[str, Dict[str, Any]]], Field(description="The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Publication + + This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication. A voucher is suitable for publication when its active and hasnt been published yet. โ—๏ธ Limited access Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. ๐Ÿšง Clearly define the source of the voucher You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. ๐Ÿšง Publish multiple vouchers This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a dedicated endpoint. ๐Ÿ“˜ Auto-update campaign In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign. # Example Request โ—๏ธ Required Query param voucher OR campaign MUST be filled out. If you provide both, campaign param will be skipped. + + :param customer: Contains information about the customer to whom the publication was directed. (required) + :type customer: Customer + :param join_once: Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer. + :type join_once: bool + :param voucher: Code of voucher being published. + :type voucher: str + :param campaign: Create publication with campaign. + :type campaign: CreatePublicationCampaign + :param source_id: The merchants publication ID if it is different from the Voucherify publication ID. Its an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If source_id is provided only 1 voucher can be published per request. + :type source_id: str + :param metadata: The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format. + :type metadata: object + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_publication1_serialize( + customer=customer, + join_once=join_once, + voucher=voucher, + campaign=campaign, + source_id=source_id, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_publication1_serialize( + self, + customer, + join_once, + voucher, + campaign, + source_id, + metadata, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if join_once is not None: + + _query_params.append(('join_once', join_once)) + + if voucher is not None: + + _query_params.append(('voucher', voucher)) + + if campaign is not None: + + _query_params.append(('campaign', campaign)) + + if source_id is not None: + + _query_params.append(('source_id', source_id)) + + if customer is not None: + + _query_params.append(('customer', customer)) + + if metadata is not None: + + _query_params.append(('metadata', metadata)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/publications/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_publications( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPublications], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="Filters by a given campaign name.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="Filters by a unique customer ID.")] = None, + voucher: Annotated[Optional[StrictStr], Field(description="Filters by a given voucher code.")] = None, + result: Annotated[Optional[ParameterResultListPublications], Field(description="Filters by a publication result.")] = None, + voucher_type: Annotated[Optional[ParameterVoucherTypeListPublications], Field(description="Filters by a voucher type.")] = None, + is_referral_code: Annotated[Optional[StrictBool], Field(description="This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. ")] = None, + filters: Annotated[Optional[StrictStr], Field(description="Allows for combining the filters mentioned in the endpoint description.")] = None, + source_id: Annotated[Optional[StrictStr], Field(description="Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PublicationsListResponseBody: + """List Publications + + Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination ๐Ÿšง Important! If you want to scroll through a huge set of records, it is recommended to use the Exports API. This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Operators: ## Examples + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPublications + :param campaign: Filters by a given campaign name. + :type campaign: str + :param customer: Filters by a unique customer ID. + :type customer: str + :param voucher: Filters by a given voucher code. + :type voucher: str + :param result: Filters by a publication result. + :type result: ParameterResultListPublications + :param voucher_type: Filters by a voucher type. + :type voucher_type: ParameterVoucherTypeListPublications + :param is_referral_code: This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. + :type is_referral_code: bool + :param filters: Allows for combining the filters mentioned in the endpoint description. + :type filters: str + :param source_id: Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. + :type source_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_publications_serialize( + limit=limit, + page=page, + order=order, + campaign=campaign, + customer=customer, + voucher=voucher, + result=result, + voucher_type=voucher_type, + is_referral_code=is_referral_code, + filters=filters, + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_publications_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPublications], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="Filters by a given campaign name.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="Filters by a unique customer ID.")] = None, + voucher: Annotated[Optional[StrictStr], Field(description="Filters by a given voucher code.")] = None, + result: Annotated[Optional[ParameterResultListPublications], Field(description="Filters by a publication result.")] = None, + voucher_type: Annotated[Optional[ParameterVoucherTypeListPublications], Field(description="Filters by a voucher type.")] = None, + is_referral_code: Annotated[Optional[StrictBool], Field(description="This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. ")] = None, + filters: Annotated[Optional[StrictStr], Field(description="Allows for combining the filters mentioned in the endpoint description.")] = None, + source_id: Annotated[Optional[StrictStr], Field(description="Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PublicationsListResponseBody]: + """List Publications + + Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination ๐Ÿšง Important! If you want to scroll through a huge set of records, it is recommended to use the Exports API. This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Operators: ## Examples + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPublications + :param campaign: Filters by a given campaign name. + :type campaign: str + :param customer: Filters by a unique customer ID. + :type customer: str + :param voucher: Filters by a given voucher code. + :type voucher: str + :param result: Filters by a publication result. + :type result: ParameterResultListPublications + :param voucher_type: Filters by a voucher type. + :type voucher_type: ParameterVoucherTypeListPublications + :param is_referral_code: This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. + :type is_referral_code: bool + :param filters: Allows for combining the filters mentioned in the endpoint description. + :type filters: str + :param source_id: Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. + :type source_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_publications_serialize( + limit=limit, + page=page, + order=order, + campaign=campaign, + customer=customer, + voucher=voucher, + result=result, + voucher_type=voucher_type, + is_referral_code=is_referral_code, + filters=filters, + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_publications_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListPublications], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="Filters by a given campaign name.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="Filters by a unique customer ID.")] = None, + voucher: Annotated[Optional[StrictStr], Field(description="Filters by a given voucher code.")] = None, + result: Annotated[Optional[ParameterResultListPublications], Field(description="Filters by a publication result.")] = None, + voucher_type: Annotated[Optional[ParameterVoucherTypeListPublications], Field(description="Filters by a voucher type.")] = None, + is_referral_code: Annotated[Optional[StrictBool], Field(description="This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. ")] = None, + filters: Annotated[Optional[StrictStr], Field(description="Allows for combining the filters mentioned in the endpoint description.")] = None, + source_id: Annotated[Optional[StrictStr], Field(description="Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Publications + + Retrieve a list of publications. To return a **particular** publication, you can use the source_id query parameter and provide the source_id of the publication you are looking for specifically. # Pagination ๐Ÿšง Important! If you want to scroll through a huge set of records, it is recommended to use the Exports API. This API will return an error page_over_limit if you reach a page above 1000. # Filter Query The filters query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows: ## Operators: ## Examples + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListPublications + :param campaign: Filters by a given campaign name. + :type campaign: str + :param customer: Filters by a unique customer ID. + :type customer: str + :param voucher: Filters by a given voucher code. + :type voucher: str + :param result: Filters by a publication result. + :type result: ParameterResultListPublications + :param voucher_type: Filters by a voucher type. + :type voucher_type: ParameterVoucherTypeListPublications + :param is_referral_code: This filter works only for the true option. If set to true, the query returns only publications of codes from referral campaigns. + :type is_referral_code: bool + :param filters: Allows for combining the filters mentioned in the endpoint description. + :type filters: str + :param source_id: Using this endpoint with a particular publication source_id, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular source_id. + :type source_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_publications_serialize( + limit=limit, + page=page, + order=order, + campaign=campaign, + customer=customer, + voucher=voucher, + result=result, + voucher_type=voucher_type, + is_referral_code=is_referral_code, + filters=filters, + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "PublicationsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_publications_serialize( + self, + limit, + page, + order, + campaign, + customer, + voucher, + result, + voucher_type, + is_referral_code, + filters, + source_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if campaign is not None: + + _query_params.append(('campaign', campaign)) + + if customer is not None: + + _query_params.append(('customer', customer)) + + if voucher is not None: + + _query_params.append(('voucher', voucher)) + + if result is not None: + + _query_params.append(('result', result.value)) + + if voucher_type is not None: + + _query_params.append(('voucher_type', voucher_type.value)) + + if is_referral_code is not None: + + _query_params.append(('is_referral_code', is_referral_code)) + + if filters is not None: + + _query_params.append(('filters', filters)) + + if source_id is not None: + + _query_params.append(('source_id', source_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/publications', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/qualifications_api.py b/voucherify/api/qualifications_api.py new file mode 100644 index 00000000..f3316cdc --- /dev/null +++ b/voucherify/api/qualifications_api.py @@ -0,0 +1,314 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.qualifications_check_eligibility_request_body import QualificationsCheckEligibilityRequestBody +from voucherify.models.qualifications_check_eligibility_response_body import QualificationsCheckEligibilityResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class QualificationsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def check_eligibility( + self, + qualifications_check_eligibility_request_body: Annotated[Optional[QualificationsCheckEligibilityRequestBody], Field(description="Define order and customer context.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> QualificationsCheckEligibilityResponseBody: + """Check Eligibility + + ๐Ÿšง The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + + :param qualifications_check_eligibility_request_body: Define order and customer context. + :type qualifications_check_eligibility_request_body: QualificationsCheckEligibilityRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_eligibility_serialize( + qualifications_check_eligibility_request_body=qualifications_check_eligibility_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "QualificationsCheckEligibilityResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def check_eligibility_with_http_info( + self, + qualifications_check_eligibility_request_body: Annotated[Optional[QualificationsCheckEligibilityRequestBody], Field(description="Define order and customer context.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[QualificationsCheckEligibilityResponseBody]: + """Check Eligibility + + ๐Ÿšง The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + + :param qualifications_check_eligibility_request_body: Define order and customer context. + :type qualifications_check_eligibility_request_body: QualificationsCheckEligibilityRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_eligibility_serialize( + qualifications_check_eligibility_request_body=qualifications_check_eligibility_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "QualificationsCheckEligibilityResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def check_eligibility_without_preload_content( + self, + qualifications_check_eligibility_request_body: Annotated[Optional[QualificationsCheckEligibilityRequestBody], Field(description="Define order and customer context.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Check Eligibility + + ๐Ÿšง The Qualifications endpoint ignores the rules checking: - Limit of total redeemed discount amount per campaign - Limit of total redemptions count per campaign - Redemptions per customer - Redemptions per customer in a campaign Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version ๐Ÿ‘ Scenario Guide Read the dedicated guide to learn about some use cases this endpoint can cover. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. + + :param qualifications_check_eligibility_request_body: Define order and customer context. + :type qualifications_check_eligibility_request_body: QualificationsCheckEligibilityRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._check_eligibility_serialize( + qualifications_check_eligibility_request_body=qualifications_check_eligibility_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "QualificationsCheckEligibilityResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _check_eligibility_serialize( + self, + qualifications_check_eligibility_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if qualifications_check_eligibility_request_body is not None: + _body_params = qualifications_check_eligibility_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/qualifications', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/redemptions_api.py b/voucherify/api/redemptions_api.py new file mode 100644 index 00000000..26e1ee3d --- /dev/null +++ b/voucherify/api/redemptions_api.py @@ -0,0 +1,1869 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_filters_list_redemptions import ParameterFiltersListRedemptions +from voucherify.models.parameter_order_list_redemptions import ParameterOrderListRedemptions +from voucherify.models.redemptions_get_response_body import RedemptionsGetResponseBody +from voucherify.models.redemptions_list_response_body import RedemptionsListResponseBody +from voucherify.models.redemptions_redeem_request_body import RedemptionsRedeemRequestBody +from voucherify.models.redemptions_redeem_response_body import RedemptionsRedeemResponseBody +from voucherify.models.redemptions_rollback_create_request_body import RedemptionsRollbackCreateRequestBody +from voucherify.models.redemptions_rollback_create_response_body import RedemptionsRollbackCreateResponseBody +from voucherify.models.redemptions_rollbacks_create_request_body import RedemptionsRollbacksCreateRequestBody +from voucherify.models.redemptions_rollbacks_create_response_body import RedemptionsRollbacksCreateResponseBody +from voucherify.models.vouchers_redemption_get_response_body import VouchersRedemptionGetResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class RedemptionsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_redemption( + self, + redemption_id: Annotated[StrictStr, Field(description="ID of previously created redemption.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RedemptionsGetResponseBody: + """Get Redemption + + Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback. + + :param redemption_id: ID of previously created redemption. (required) + :type redemption_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_redemption_serialize( + redemption_id=redemption_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_redemption_with_http_info( + self, + redemption_id: Annotated[StrictStr, Field(description="ID of previously created redemption.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RedemptionsGetResponseBody]: + """Get Redemption + + Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback. + + :param redemption_id: ID of previously created redemption. (required) + :type redemption_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_redemption_serialize( + redemption_id=redemption_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_redemption_without_preload_content( + self, + redemption_id: Annotated[StrictStr, Field(description="ID of previously created redemption.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Redemption + + Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback. + + :param redemption_id: ID of previously created redemption. (required) + :type redemption_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_redemption_serialize( + redemption_id=redemption_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_redemption_serialize( + self, + redemption_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if redemption_id is not None: + _path_params['redemptionId'] = redemption_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/redemptions/{redemptionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_voucher_redemptions( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersRedemptionGetResponseBody: + """Get Voucher's Redemptions + + Retrieve the number of times a voucher was redeemed and each of the redemption details. + + :param code: A **code** that identifies the voucher. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_voucher_redemptions_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersRedemptionGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_voucher_redemptions_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersRedemptionGetResponseBody]: + """Get Voucher's Redemptions + + Retrieve the number of times a voucher was redeemed and each of the redemption details. + + :param code: A **code** that identifies the voucher. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_voucher_redemptions_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersRedemptionGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_voucher_redemptions_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Voucher's Redemptions + + Retrieve the number of times a voucher was redeemed and each of the redemption details. + + :param code: A **code** that identifies the voucher. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_voucher_redemptions_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersRedemptionGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_voucher_redemptions_serialize( + self, + code, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/vouchers/{code}/redemption', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_redemptions( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + result: Annotated[Optional[StrictStr], Field(description="A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="A filter by the campaign **name** that the redemption resources originate from.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="Return redemptions performed by the customer with given id or source_id.")] = None, + order: Annotated[Optional[ParameterOrderListRedemptions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + filters: Annotated[Optional[ParameterFiltersListRedemptions], Field(description="Filters for listing responses.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RedemptionsListResponseBody: + """List Redemptions + + Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. # Filtering results The result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date: https://api.voucherify.io/v1/redemptions?limit 3&[created_at][before] 2017-09-08T13:52:18.227Z. A filter based on the object created_at field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: [created_at][after], [created_at][before]. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z. # Failed Redemptions A redemption may fail for various reasons. You can figure out an exact reason from the failure_code: - resource_not_found - voucher with given code does not exist - voucher_not_active - voucher is not active yet (before start date) - voucher_expired - voucher has already expired (after expiration date) - voucher_disabled - voucher has been disabled (active: false) - quantity_exceeded - vouchers redemptions limit has been exceeded - gift_amount_exceeded - gift amount has been exceeded - customer_rules_violated - customer did not match the segment - order_rules_violated - order did not match validation rules - invalid_order - order was specified incorrectly - invalid_amount - order amount was specified incorrectly - missing_amount - order amount was not specified - missing_order_items - order items were not specified - missing_customer - customer was not specified + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param result: A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. + :type result: str + :param campaign: A filter by the campaign **name** that the redemption resources originate from. + :type campaign: str + :param customer: Return redemptions performed by the customer with given id or source_id. + :type customer: str + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListRedemptions + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param filters: Filters for listing responses. + :type filters: ParameterFiltersListRedemptions + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_redemptions_serialize( + limit=limit, + page=page, + result=result, + campaign=campaign, + customer=customer, + order=order, + created_at=created_at, + filters=filters, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_redemptions_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + result: Annotated[Optional[StrictStr], Field(description="A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="A filter by the campaign **name** that the redemption resources originate from.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="Return redemptions performed by the customer with given id or source_id.")] = None, + order: Annotated[Optional[ParameterOrderListRedemptions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + filters: Annotated[Optional[ParameterFiltersListRedemptions], Field(description="Filters for listing responses.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RedemptionsListResponseBody]: + """List Redemptions + + Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. # Filtering results The result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date: https://api.voucherify.io/v1/redemptions?limit 3&[created_at][before] 2017-09-08T13:52:18.227Z. A filter based on the object created_at field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: [created_at][after], [created_at][before]. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z. # Failed Redemptions A redemption may fail for various reasons. You can figure out an exact reason from the failure_code: - resource_not_found - voucher with given code does not exist - voucher_not_active - voucher is not active yet (before start date) - voucher_expired - voucher has already expired (after expiration date) - voucher_disabled - voucher has been disabled (active: false) - quantity_exceeded - vouchers redemptions limit has been exceeded - gift_amount_exceeded - gift amount has been exceeded - customer_rules_violated - customer did not match the segment - order_rules_violated - order did not match validation rules - invalid_order - order was specified incorrectly - invalid_amount - order amount was specified incorrectly - missing_amount - order amount was not specified - missing_order_items - order items were not specified - missing_customer - customer was not specified + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param result: A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. + :type result: str + :param campaign: A filter by the campaign **name** that the redemption resources originate from. + :type campaign: str + :param customer: Return redemptions performed by the customer with given id or source_id. + :type customer: str + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListRedemptions + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param filters: Filters for listing responses. + :type filters: ParameterFiltersListRedemptions + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_redemptions_serialize( + limit=limit, + page=page, + result=result, + campaign=campaign, + customer=customer, + order=order, + created_at=created_at, + filters=filters, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_redemptions_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + result: Annotated[Optional[StrictStr], Field(description="A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="A filter by the campaign **name** that the redemption resources originate from.")] = None, + customer: Annotated[Optional[StrictStr], Field(description="Return redemptions performed by the customer with given id or source_id.")] = None, + order: Annotated[Optional[ParameterOrderListRedemptions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + filters: Annotated[Optional[ParameterFiltersListRedemptions], Field(description="Filters for listing responses.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Redemptions + + Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. # Filtering results The result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date: https://api.voucherify.io/v1/redemptions?limit 3&[created_at][before] 2017-09-08T13:52:18.227Z. A filter based on the object created_at field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: [created_at][after], [created_at][before]. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z. # Failed Redemptions A redemption may fail for various reasons. You can figure out an exact reason from the failure_code: - resource_not_found - voucher with given code does not exist - voucher_not_active - voucher is not active yet (before start date) - voucher_expired - voucher has already expired (after expiration date) - voucher_disabled - voucher has been disabled (active: false) - quantity_exceeded - vouchers redemptions limit has been exceeded - gift_amount_exceeded - gift amount has been exceeded - customer_rules_violated - customer did not match the segment - order_rules_violated - order did not match validation rules - invalid_order - order was specified incorrectly - invalid_amount - order amount was specified incorrectly - missing_amount - order amount was not specified - missing_order_items - order items were not specified - missing_customer - customer was not specified + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param result: A filter on the list based on the redemption result. Available options are: SUCCESS, FAILURE. You can provide multiple values by repeating the param. + :type result: str + :param campaign: A filter by the campaign **name** that the redemption resources originate from. + :type campaign: str + :param customer: Return redemptions performed by the customer with given id or source_id. + :type customer: str + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListRedemptions + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param filters: Filters for listing responses. + :type filters: ParameterFiltersListRedemptions + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_redemptions_serialize( + limit=limit, + page=page, + result=result, + campaign=campaign, + customer=customer, + order=order, + created_at=created_at, + filters=filters, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_redemptions_serialize( + self, + limit, + page, + result, + campaign, + customer, + order, + created_at, + filters, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if result is not None: + + _query_params.append(('result', result)) + + if campaign is not None: + + _query_params.append(('campaign', campaign)) + + if customer is not None: + + _query_params.append(('customer', customer)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if created_at is not None: + + _query_params.append(('created_at', created_at)) + + if filters is not None: + + _query_params.append(('filters', filters)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/redemptions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def redeem_stacked_discounts( + self, + redemptions_redeem_request_body: Optional[RedemptionsRedeemRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RedemptionsRedeemResponseBody: + """Redeem Stackable Discounts + + # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. ๐Ÿ“˜ Also available on client-side This method is also accessible through public keys which you can use in client-sideโ€‹ apps: mobile and web browser apps. Go to the dedicated endpoint to learn more. - Use X-Client-Application-Id as the application ID header. - Use X-Client-Token as the appliction secret key header. - Use client-side base URL. - Use an origin header for your custom domain. + + :param redemptions_redeem_request_body: + :type redemptions_redeem_request_body: RedemptionsRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_stacked_discounts_serialize( + redemptions_redeem_request_body=redemptions_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def redeem_stacked_discounts_with_http_info( + self, + redemptions_redeem_request_body: Optional[RedemptionsRedeemRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RedemptionsRedeemResponseBody]: + """Redeem Stackable Discounts + + # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. ๐Ÿ“˜ Also available on client-side This method is also accessible through public keys which you can use in client-sideโ€‹ apps: mobile and web browser apps. Go to the dedicated endpoint to learn more. - Use X-Client-Application-Id as the application ID header. - Use X-Client-Token as the appliction secret key header. - Use client-side base URL. - Use an origin header for your custom domain. + + :param redemptions_redeem_request_body: + :type redemptions_redeem_request_body: RedemptionsRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_stacked_discounts_serialize( + redemptions_redeem_request_body=redemptions_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def redeem_stacked_discounts_without_preload_content( + self, + redemptions_redeem_request_body: Optional[RedemptionsRedeemRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Redeem Stackable Discounts + + # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: ๐Ÿ“˜ Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request. ๐Ÿ“˜ Also available on client-side This method is also accessible through public keys which you can use in client-sideโ€‹ apps: mobile and web browser apps. Go to the dedicated endpoint to learn more. - Use X-Client-Application-Id as the application ID header. - Use X-Client-Token as the appliction secret key header. - Use client-side base URL. - Use an origin header for your custom domain. + + :param redemptions_redeem_request_body: + :type redemptions_redeem_request_body: RedemptionsRedeemRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._redeem_stacked_discounts_serialize( + redemptions_redeem_request_body=redemptions_redeem_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRedeemResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _redeem_stacked_discounts_serialize( + self, + redemptions_redeem_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if redemptions_redeem_request_body is not None: + _body_params = redemptions_redeem_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/redemptions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def rollback_redemption( + self, + redemption_id: Annotated[StrictStr, Field(description="The original redemption ID to be rolled back (undone).")], + reason: Annotated[Optional[StrictStr], Field(description="Reason for the rollback.")] = None, + tracking_id: Annotated[Optional[StrictStr], Field(description="Customers source_id.")] = None, + redemptions_rollback_create_request_body: Annotated[Optional[RedemptionsRollbackCreateRequestBody], Field(description="Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RedemptionsRollbackCreateResponseBody: + """Rollback Redemption + + Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. ๐Ÿšง You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. + + :param redemption_id: The original redemption ID to be rolled back (undone). (required) + :type redemption_id: str + :param reason: Reason for the rollback. + :type reason: str + :param tracking_id: Customers source_id. + :type tracking_id: str + :param redemptions_rollback_create_request_body: Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. + :type redemptions_rollback_create_request_body: RedemptionsRollbackCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rollback_redemption_serialize( + redemption_id=redemption_id, + reason=reason, + tracking_id=tracking_id, + redemptions_rollback_create_request_body=redemptions_rollback_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRollbackCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def rollback_redemption_with_http_info( + self, + redemption_id: Annotated[StrictStr, Field(description="The original redemption ID to be rolled back (undone).")], + reason: Annotated[Optional[StrictStr], Field(description="Reason for the rollback.")] = None, + tracking_id: Annotated[Optional[StrictStr], Field(description="Customers source_id.")] = None, + redemptions_rollback_create_request_body: Annotated[Optional[RedemptionsRollbackCreateRequestBody], Field(description="Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RedemptionsRollbackCreateResponseBody]: + """Rollback Redemption + + Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. ๐Ÿšง You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. + + :param redemption_id: The original redemption ID to be rolled back (undone). (required) + :type redemption_id: str + :param reason: Reason for the rollback. + :type reason: str + :param tracking_id: Customers source_id. + :type tracking_id: str + :param redemptions_rollback_create_request_body: Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. + :type redemptions_rollback_create_request_body: RedemptionsRollbackCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rollback_redemption_serialize( + redemption_id=redemption_id, + reason=reason, + tracking_id=tracking_id, + redemptions_rollback_create_request_body=redemptions_rollback_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRollbackCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def rollback_redemption_without_preload_content( + self, + redemption_id: Annotated[StrictStr, Field(description="The original redemption ID to be rolled back (undone).")], + reason: Annotated[Optional[StrictStr], Field(description="Reason for the rollback.")] = None, + tracking_id: Annotated[Optional[StrictStr], Field(description="Customers source_id.")] = None, + redemptions_rollback_create_request_body: Annotated[Optional[RedemptionsRollbackCreateRequestBody], Field(description="Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Rollback Redemption + + Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. ๐Ÿšง You can roll back a redemption up to 3 months back. # Effect The operation - creates a rollback entry in vouchers redemption history (redemption.redemption_entries) and - gives 1 redemption back to the pool (decreases redeemed_quantity by 1). # Returned funds In case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption. + + :param redemption_id: The original redemption ID to be rolled back (undone). (required) + :type redemption_id: str + :param reason: Reason for the rollback. + :type reason: str + :param tracking_id: Customers source_id. + :type tracking_id: str + :param redemptions_rollback_create_request_body: Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. + :type redemptions_rollback_create_request_body: RedemptionsRollbackCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rollback_redemption_serialize( + redemption_id=redemption_id, + reason=reason, + tracking_id=tracking_id, + redemptions_rollback_create_request_body=redemptions_rollback_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRollbackCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _rollback_redemption_serialize( + self, + redemption_id, + reason, + tracking_id, + redemptions_rollback_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if redemption_id is not None: + _path_params['redemptionId'] = redemption_id + # process the query parameters + if reason is not None: + + _query_params.append(('reason', reason)) + + if tracking_id is not None: + + _query_params.append(('tracking_id', tracking_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + if redemptions_rollback_create_request_body is not None: + _body_params = redemptions_rollback_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/redemptions/{redemptionId}/rollback', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def rollback_stacked_redemptions( + self, + parent_redemption_id: Annotated[StrictStr, Field(description="Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm.")], + reason: Annotated[Optional[StrictStr], Field(description="Reason for the rollback.")] = None, + tracking_id: Annotated[Optional[StrictStr], Field(description="Customers source_id.")] = None, + redemptions_rollbacks_create_request_body: Annotated[Optional[RedemptionsRollbacksCreateRequestBody], Field(description="Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RedemptionsRollbacksCreateResponseBody: + """Rollback Stackable Redemptions + + Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. ๐Ÿšง You can roll back a redemption up to 3 months back. + + :param parent_redemption_id: Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + :type parent_redemption_id: str + :param reason: Reason for the rollback. + :type reason: str + :param tracking_id: Customers source_id. + :type tracking_id: str + :param redemptions_rollbacks_create_request_body: Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. + :type redemptions_rollbacks_create_request_body: RedemptionsRollbacksCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rollback_stacked_redemptions_serialize( + parent_redemption_id=parent_redemption_id, + reason=reason, + tracking_id=tracking_id, + redemptions_rollbacks_create_request_body=redemptions_rollbacks_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRollbacksCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def rollback_stacked_redemptions_with_http_info( + self, + parent_redemption_id: Annotated[StrictStr, Field(description="Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm.")], + reason: Annotated[Optional[StrictStr], Field(description="Reason for the rollback.")] = None, + tracking_id: Annotated[Optional[StrictStr], Field(description="Customers source_id.")] = None, + redemptions_rollbacks_create_request_body: Annotated[Optional[RedemptionsRollbacksCreateRequestBody], Field(description="Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RedemptionsRollbacksCreateResponseBody]: + """Rollback Stackable Redemptions + + Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. ๐Ÿšง You can roll back a redemption up to 3 months back. + + :param parent_redemption_id: Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + :type parent_redemption_id: str + :param reason: Reason for the rollback. + :type reason: str + :param tracking_id: Customers source_id. + :type tracking_id: str + :param redemptions_rollbacks_create_request_body: Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. + :type redemptions_rollbacks_create_request_body: RedemptionsRollbacksCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rollback_stacked_redemptions_serialize( + parent_redemption_id=parent_redemption_id, + reason=reason, + tracking_id=tracking_id, + redemptions_rollbacks_create_request_body=redemptions_rollbacks_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRollbacksCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def rollback_stacked_redemptions_without_preload_content( + self, + parent_redemption_id: Annotated[StrictStr, Field(description="Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm.")], + reason: Annotated[Optional[StrictStr], Field(description="Reason for the rollback.")] = None, + tracking_id: Annotated[Optional[StrictStr], Field(description="Customers source_id.")] = None, + redemptions_rollbacks_create_request_body: Annotated[Optional[RedemptionsRollbacksCreateRequestBody], Field(description="Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Rollback Stackable Redemptions + + Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter. ๐Ÿšง You can roll back a redemption up to 3 months back. + + :param parent_redemption_id: Unique identifier of a parent redemption, e.g. r_JQfm73zWSJFQxs3bGxweYjgm. (required) + :type parent_redemption_id: str + :param reason: Reason for the rollback. + :type reason: str + :param tracking_id: Customers source_id. + :type tracking_id: str + :param redemptions_rollbacks_create_request_body: Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body. + :type redemptions_rollbacks_create_request_body: RedemptionsRollbacksCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rollback_stacked_redemptions_serialize( + parent_redemption_id=parent_redemption_id, + reason=reason, + tracking_id=tracking_id, + redemptions_rollbacks_create_request_body=redemptions_rollbacks_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RedemptionsRollbacksCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _rollback_stacked_redemptions_serialize( + self, + parent_redemption_id, + reason, + tracking_id, + redemptions_rollbacks_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if parent_redemption_id is not None: + _path_params['parentRedemptionId'] = parent_redemption_id + # process the query parameters + if reason is not None: + + _query_params.append(('reason', reason)) + + if tracking_id is not None: + + _query_params.append(('tracking_id', tracking_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + if redemptions_rollbacks_create_request_body is not None: + _body_params = redemptions_rollbacks_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/redemptions/{parentRedemptionId}/rollbacks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/rewards_api.py b/voucherify/api/rewards_api.py new file mode 100644 index 00000000..e8702709 --- /dev/null +++ b/voucherify/api/rewards_api.py @@ -0,0 +1,2849 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.reward import Reward +from voucherify.models.rewards_assignments_create_request_body import RewardsAssignmentsCreateRequestBody +from voucherify.models.rewards_assignments_create_response_body import RewardsAssignmentsCreateResponseBody +from voucherify.models.rewards_assignments_get_response_body import RewardsAssignmentsGetResponseBody +from voucherify.models.rewards_assignments_list_response_body import RewardsAssignmentsListResponseBody +from voucherify.models.rewards_assignments_update_request_body import RewardsAssignmentsUpdateRequestBody +from voucherify.models.rewards_assignments_update_response_body import RewardsAssignmentsUpdateResponseBody +from voucherify.models.rewards_create_request_body import RewardsCreateRequestBody +from voucherify.models.rewards_create_response_body import RewardsCreateResponseBody +from voucherify.models.rewards_list_response_body import RewardsListResponseBody +from voucherify.models.rewards_update_request_body import RewardsUpdateRequestBody +from voucherify.models.rewards_update_response_body import RewardsUpdateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class RewardsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_reward( + self, + rewards_create_request_body: Annotated[Optional[RewardsCreateRequestBody], Field(description="Define parameters of the new reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RewardsCreateResponseBody: + """Create Reward + + Create a new reward. + + :param rewards_create_request_body: Define parameters of the new reward. + :type rewards_create_request_body: RewardsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_serialize( + rewards_create_request_body=rewards_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_reward_with_http_info( + self, + rewards_create_request_body: Annotated[Optional[RewardsCreateRequestBody], Field(description="Define parameters of the new reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RewardsCreateResponseBody]: + """Create Reward + + Create a new reward. + + :param rewards_create_request_body: Define parameters of the new reward. + :type rewards_create_request_body: RewardsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_serialize( + rewards_create_request_body=rewards_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_reward_without_preload_content( + self, + rewards_create_request_body: Annotated[Optional[RewardsCreateRequestBody], Field(description="Define parameters of the new reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Reward + + Create a new reward. + + :param rewards_create_request_body: Define parameters of the new reward. + :type rewards_create_request_body: RewardsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_serialize( + rewards_create_request_body=rewards_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_reward_serialize( + self, + rewards_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if rewards_create_request_body is not None: + _body_params = rewards_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/rewards', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_reward_assignment( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + rewards_assignments_create_request_body: Annotated[Optional[RewardsAssignmentsCreateRequestBody], Field(description="Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RewardsAssignmentsCreateResponseBody: + """Create Reward Assignment + + Assigns a reward to a specified loyalty campaign. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param rewards_assignments_create_request_body: Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. + :type rewards_assignments_create_request_body: RewardsAssignmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_assignment_serialize( + reward_id=reward_id, + rewards_assignments_create_request_body=rewards_assignments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_reward_assignment_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + rewards_assignments_create_request_body: Annotated[Optional[RewardsAssignmentsCreateRequestBody], Field(description="Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RewardsAssignmentsCreateResponseBody]: + """Create Reward Assignment + + Assigns a reward to a specified loyalty campaign. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param rewards_assignments_create_request_body: Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. + :type rewards_assignments_create_request_body: RewardsAssignmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_assignment_serialize( + reward_id=reward_id, + rewards_assignments_create_request_body=rewards_assignments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_reward_assignment_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + rewards_assignments_create_request_body: Annotated[Optional[RewardsAssignmentsCreateRequestBody], Field(description="Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Reward Assignment + + Assigns a reward to a specified loyalty campaign. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param rewards_assignments_create_request_body: Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points. + :type rewards_assignments_create_request_body: RewardsAssignmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_reward_assignment_serialize( + reward_id=reward_id, + rewards_assignments_create_request_body=rewards_assignments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_reward_assignment_serialize( + self, + reward_id, + rewards_assignments_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if rewards_assignments_create_request_body is not None: + _body_params = rewards_assignments_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/rewards/{rewardId}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_reward( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Reward + + Delete a reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_serialize( + reward_id=reward_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_reward_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Reward + + Delete a reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_serialize( + reward_id=reward_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_reward_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Reward + + Delete a reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_serialize( + reward_id=reward_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_reward_serialize( + self, + reward_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/rewards/{rewardId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_reward_assignment( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Reward Assignment + + This method deletes a reward assignment for a particular reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_reward_assignment_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Reward Assignment + + This method deletes a reward assignment for a particular reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_reward_assignment_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Reward Assignment + + This method deletes a reward assignment for a particular reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_reward_assignment_serialize( + self, + reward_id, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/rewards/{rewardId}/assignments/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_reward( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Reward: + """Get Reward + + Retrieve a reward by the reward ID. + + :param reward_id: A unique reward ID. (required) + :type reward_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_serialize( + reward_id=reward_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "Reward", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_reward_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Reward]: + """Get Reward + + Retrieve a reward by the reward ID. + + :param reward_id: A unique reward ID. (required) + :type reward_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_serialize( + reward_id=reward_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "Reward", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_reward_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Reward + + Retrieve a reward by the reward ID. + + :param reward_id: A unique reward ID. (required) + :type reward_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_serialize( + reward_id=reward_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "Reward", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_reward_serialize( + self, + reward_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/rewards/{rewardId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_reward_assignment( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RewardsAssignmentsGetResponseBody: + """Get Reward Assignment + + Retrieve a reward assignment. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_reward_assignment_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RewardsAssignmentsGetResponseBody]: + """Get Reward Assignment + + Retrieve a reward assignment. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_reward_assignment_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Reward Assignment + + Retrieve a reward assignment. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_reward_assignment_serialize( + self, + reward_id, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/rewards/{rewardId}/assignments/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_reward_assignments( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RewardsAssignmentsListResponseBody: + """List Reward Assignments + + Retrieve reward assignments by the reward ID. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments_serialize( + reward_id=reward_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_reward_assignments_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RewardsAssignmentsListResponseBody]: + """List Reward Assignments + + Retrieve reward assignments by the reward ID. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments_serialize( + reward_id=reward_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_reward_assignments_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Reward Assignments + + Retrieve reward assignments by the reward ID. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_reward_assignments_serialize( + reward_id=reward_id, + limit=limit, + page=page, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_reward_assignments_serialize( + self, + reward_id, + limit, + page, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/rewards/{rewardId}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_rewards( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RewardsListResponseBody: + """List Rewards + + Retrieve rewards. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_rewards_serialize( + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_rewards_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RewardsListResponseBody]: + """List Rewards + + Retrieve rewards. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_rewards_serialize( + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_rewards_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + assignment_id: Annotated[Optional[StrictStr], Field(description="A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Rewards + + Retrieve rewards. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param assignment_id: A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID. + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_rewards_serialize( + limit=limit, + page=page, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_rewards_serialize( + self, + limit, + page, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if assignment_id is not None: + + _query_params.append(('assignment_id', assignment_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/rewards', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_reward( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + rewards_update_request_body: Annotated[Optional[RewardsUpdateRequestBody], Field(description="Define the parameters to be updated for the reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RewardsUpdateResponseBody: + """Update Reward + + Update the details of a reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param rewards_update_request_body: Define the parameters to be updated for the reward. + :type rewards_update_request_body: RewardsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_serialize( + reward_id=reward_id, + rewards_update_request_body=rewards_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_reward_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + rewards_update_request_body: Annotated[Optional[RewardsUpdateRequestBody], Field(description="Define the parameters to be updated for the reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RewardsUpdateResponseBody]: + """Update Reward + + Update the details of a reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param rewards_update_request_body: Define the parameters to be updated for the reward. + :type rewards_update_request_body: RewardsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_serialize( + reward_id=reward_id, + rewards_update_request_body=rewards_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_reward_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + rewards_update_request_body: Annotated[Optional[RewardsUpdateRequestBody], Field(description="Define the parameters to be updated for the reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Reward + + Update the details of a reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param rewards_update_request_body: Define the parameters to be updated for the reward. + :type rewards_update_request_body: RewardsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_serialize( + reward_id=reward_id, + rewards_update_request_body=rewards_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_reward_serialize( + self, + reward_id, + rewards_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if rewards_update_request_body is not None: + _body_params = rewards_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/rewards/{rewardId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_reward_assignment( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + rewards_assignments_update_request_body: Annotated[Optional[RewardsAssignmentsUpdateRequestBody], Field(description="Define the number of points required to exchange for the reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RewardsAssignmentsUpdateResponseBody: + """Update Reward Assignment + + Update the number of points needed to successfully redeem the reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: str + :param rewards_assignments_update_request_body: Define the number of points required to exchange for the reward. + :type rewards_assignments_update_request_body: RewardsAssignmentsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + rewards_assignments_update_request_body=rewards_assignments_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_reward_assignment_with_http_info( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + rewards_assignments_update_request_body: Annotated[Optional[RewardsAssignmentsUpdateRequestBody], Field(description="Define the number of points required to exchange for the reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RewardsAssignmentsUpdateResponseBody]: + """Update Reward Assignment + + Update the number of points needed to successfully redeem the reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: str + :param rewards_assignments_update_request_body: Define the number of points required to exchange for the reward. + :type rewards_assignments_update_request_body: RewardsAssignmentsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + rewards_assignments_update_request_body=rewards_assignments_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_reward_assignment_without_preload_content( + self, + reward_id: Annotated[StrictStr, Field(description="A unique reward ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique reward assignment ID.")], + rewards_assignments_update_request_body: Annotated[Optional[RewardsAssignmentsUpdateRequestBody], Field(description="Define the number of points required to exchange for the reward.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Reward Assignment + + Update the number of points needed to successfully redeem the reward. + + :param reward_id: A unique reward ID. (required) + :type reward_id: str + :param assignment_id: A unique reward assignment ID. (required) + :type assignment_id: str + :param rewards_assignments_update_request_body: Define the number of points required to exchange for the reward. + :type rewards_assignments_update_request_body: RewardsAssignmentsUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_reward_assignment_serialize( + reward_id=reward_id, + assignment_id=assignment_id, + rewards_assignments_update_request_body=rewards_assignments_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "RewardsAssignmentsUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_reward_assignment_serialize( + self, + reward_id, + assignment_id, + rewards_assignments_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if reward_id is not None: + _path_params['rewardId'] = reward_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if rewards_assignments_update_request_body is not None: + _body_params = rewards_assignments_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/rewards/{rewardId}/assignments/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/segments_api.py b/voucherify/api/segments_api.py new file mode 100644 index 00000000..ccf7eb6a --- /dev/null +++ b/voucherify/api/segments_api.py @@ -0,0 +1,828 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.segments_create_request_body import SegmentsCreateRequestBody +from voucherify.models.segments_create_response_body import SegmentsCreateResponseBody +from voucherify.models.segments_get_response_body import SegmentsGetResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class SegmentsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_segment( + self, + segments_create_request_body: Annotated[Optional[SegmentsCreateRequestBody], Field(description="Specify the boundary conditions for the customer segment.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SegmentsCreateResponseBody: + """Create Segment + + Create a customer segment. ๐Ÿšง Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + + :param segments_create_request_body: Specify the boundary conditions for the customer segment. + :type segments_create_request_body: SegmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_segment_serialize( + segments_create_request_body=segments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SegmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_segment_with_http_info( + self, + segments_create_request_body: Annotated[Optional[SegmentsCreateRequestBody], Field(description="Specify the boundary conditions for the customer segment.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SegmentsCreateResponseBody]: + """Create Segment + + Create a customer segment. ๐Ÿšง Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + + :param segments_create_request_body: Specify the boundary conditions for the customer segment. + :type segments_create_request_body: SegmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_segment_serialize( + segments_create_request_body=segments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SegmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_segment_without_preload_content( + self, + segments_create_request_body: Annotated[Optional[SegmentsCreateRequestBody], Field(description="Specify the boundary conditions for the customer segment.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Segment + + Create a customer segment. ๐Ÿšง Limit on Static Segments There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment. + + :param segments_create_request_body: Specify the boundary conditions for the customer segment. + :type segments_create_request_body: SegmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_segment_serialize( + segments_create_request_body=segments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SegmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_segment_serialize( + self, + segments_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if segments_create_request_body is not None: + _body_params = segments_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/segments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_segment( + self, + segment_id: Annotated[StrictStr, Field(description="A unique customer segment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Segment + + This method deletes a customer segment. + + :param segment_id: A unique customer segment ID. (required) + :type segment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_segment_serialize( + segment_id=segment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_segment_with_http_info( + self, + segment_id: Annotated[StrictStr, Field(description="A unique customer segment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Segment + + This method deletes a customer segment. + + :param segment_id: A unique customer segment ID. (required) + :type segment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_segment_serialize( + segment_id=segment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_segment_without_preload_content( + self, + segment_id: Annotated[StrictStr, Field(description="A unique customer segment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Segment + + This method deletes a customer segment. + + :param segment_id: A unique customer segment ID. (required) + :type segment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_segment_serialize( + segment_id=segment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_segment_serialize( + self, + segment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if segment_id is not None: + _path_params['segmentId'] = segment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/segments/{segmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_segment( + self, + segment_id: Annotated[StrictStr, Field(description="A unique customer segment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SegmentsGetResponseBody: + """Get Segment + + Retrieves the segment with given segment ID. + + :param segment_id: A unique customer segment ID. (required) + :type segment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_segment_serialize( + segment_id=segment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SegmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_segment_with_http_info( + self, + segment_id: Annotated[StrictStr, Field(description="A unique customer segment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SegmentsGetResponseBody]: + """Get Segment + + Retrieves the segment with given segment ID. + + :param segment_id: A unique customer segment ID. (required) + :type segment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_segment_serialize( + segment_id=segment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SegmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_segment_without_preload_content( + self, + segment_id: Annotated[StrictStr, Field(description="A unique customer segment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Segment + + Retrieves the segment with given segment ID. + + :param segment_id: A unique customer segment ID. (required) + :type segment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_segment_serialize( + segment_id=segment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "SegmentsGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_segment_serialize( + self, + segment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if segment_id is not None: + _path_params['segmentId'] = segment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/segments/{segmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/validation_rules_api.py b/voucherify/api/validation_rules_api.py new file mode 100644 index 00000000..b7ce59c5 --- /dev/null +++ b/voucherify/api/validation_rules_api.py @@ -0,0 +1,2687 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from datetime import datetime +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated +from voucherify.models.parameter_order_list_validation_rule_assignments import ParameterOrderListValidationRuleAssignments +from voucherify.models.parameter_order_list_validation_rules import ParameterOrderListValidationRules +from voucherify.models.validation_rules_assignments_create_request_body import ValidationRulesAssignmentsCreateRequestBody +from voucherify.models.validation_rules_assignments_create_response_body import ValidationRulesAssignmentsCreateResponseBody +from voucherify.models.validation_rules_assignments_list_response_body import ValidationRulesAssignmentsListResponseBody +from voucherify.models.validation_rules_create_request_body import ValidationRulesCreateRequestBody +from voucherify.models.validation_rules_create_response_body import ValidationRulesCreateResponseBody +from voucherify.models.validation_rules_get_response_body import ValidationRulesGetResponseBody +from voucherify.models.validation_rules_list_response_body import ValidationRulesListResponseBody +from voucherify.models.validation_rules_update_request_body import ValidationRulesUpdateRequestBody +from voucherify.models.validation_rules_update_response_body import ValidationRulesUpdateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class ValidationRulesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_validation_rule_assignment( + self, + validation_rule_id: Annotated[StrictStr, Field(description="Unique validation rule ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added.")] = None, + validation_rules_assignments_create_request_body: Annotated[Optional[ValidationRulesAssignmentsCreateRequestBody], Field(description="Specify the resource that you would like to assign the validation rule to.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationRulesAssignmentsCreateResponseBody: + """Create Validation Rules Assignments + + Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution. + + :param validation_rule_id: Unique validation rule ID. (required) + :type validation_rule_id: str + :param force: If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. + :type force: bool + :param validation_rules_assignments_create_request_body: Specify the resource that you would like to assign the validation rule to. + :type validation_rules_assignments_create_request_body: ValidationRulesAssignmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_validation_rule_assignment_serialize( + validation_rule_id=validation_rule_id, + force=force, + validation_rules_assignments_create_request_body=validation_rules_assignments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_validation_rule_assignment_with_http_info( + self, + validation_rule_id: Annotated[StrictStr, Field(description="Unique validation rule ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added.")] = None, + validation_rules_assignments_create_request_body: Annotated[Optional[ValidationRulesAssignmentsCreateRequestBody], Field(description="Specify the resource that you would like to assign the validation rule to.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationRulesAssignmentsCreateResponseBody]: + """Create Validation Rules Assignments + + Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution. + + :param validation_rule_id: Unique validation rule ID. (required) + :type validation_rule_id: str + :param force: If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. + :type force: bool + :param validation_rules_assignments_create_request_body: Specify the resource that you would like to assign the validation rule to. + :type validation_rules_assignments_create_request_body: ValidationRulesAssignmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_validation_rule_assignment_serialize( + validation_rule_id=validation_rule_id, + force=force, + validation_rules_assignments_create_request_body=validation_rules_assignments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_validation_rule_assignment_without_preload_content( + self, + validation_rule_id: Annotated[StrictStr, Field(description="Unique validation rule ID.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added.")] = None, + validation_rules_assignments_create_request_body: Annotated[Optional[ValidationRulesAssignmentsCreateRequestBody], Field(description="Specify the resource that you would like to assign the validation rule to.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Validation Rules Assignments + + Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution. + + :param validation_rule_id: Unique validation rule ID. (required) + :type validation_rule_id: str + :param force: If this flag is set to true, the previous assignment with the same data will be deleted and a new one will be added. + :type force: bool + :param validation_rules_assignments_create_request_body: Specify the resource that you would like to assign the validation rule to. + :type validation_rules_assignments_create_request_body: ValidationRulesAssignmentsCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_validation_rule_assignment_serialize( + validation_rule_id=validation_rule_id, + force=force, + validation_rules_assignments_create_request_body=validation_rules_assignments_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_validation_rule_assignment_serialize( + self, + validation_rule_id, + force, + validation_rules_assignments_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if validation_rule_id is not None: + _path_params['validationRuleId'] = validation_rule_id + # process the query parameters + if force is not None: + + _query_params.append(('force', force)) + + # process the header parameters + # process the form parameters + # process the body parameter + if validation_rules_assignments_create_request_body is not None: + _body_params = validation_rules_assignments_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/validation-rules/{validationRuleId}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def create_validation_rules( + self, + validation_rules_create_request_body: Annotated[Optional[ValidationRulesCreateRequestBody], Field(description="Specify the validation rules parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationRulesCreateResponseBody: + """Create Validation Rules + + Create validation rules. + + :param validation_rules_create_request_body: Specify the validation rules parameters. + :type validation_rules_create_request_body: ValidationRulesCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_validation_rules_serialize( + validation_rules_create_request_body=validation_rules_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_validation_rules_with_http_info( + self, + validation_rules_create_request_body: Annotated[Optional[ValidationRulesCreateRequestBody], Field(description="Specify the validation rules parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationRulesCreateResponseBody]: + """Create Validation Rules + + Create validation rules. + + :param validation_rules_create_request_body: Specify the validation rules parameters. + :type validation_rules_create_request_body: ValidationRulesCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_validation_rules_serialize( + validation_rules_create_request_body=validation_rules_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_validation_rules_without_preload_content( + self, + validation_rules_create_request_body: Annotated[Optional[ValidationRulesCreateRequestBody], Field(description="Specify the validation rules parameters.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Validation Rules + + Create validation rules. + + :param validation_rules_create_request_body: Specify the validation rules parameters. + :type validation_rules_create_request_body: ValidationRulesCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_validation_rules_serialize( + validation_rules_create_request_body=validation_rules_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_validation_rules_serialize( + self, + validation_rules_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if validation_rules_create_request_body is not None: + _body_params = validation_rules_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/validation-rules', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_validation_rule_assignment( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique validation rule assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Validation Rule Assignment + + This method deletes a validation rule assignment. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: str + :param assignment_id: A unique validation rule assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_validation_rule_assignment_serialize( + validation_rule_id=validation_rule_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_validation_rule_assignment_with_http_info( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique validation rule assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Validation Rule Assignment + + This method deletes a validation rule assignment. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: str + :param assignment_id: A unique validation rule assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_validation_rule_assignment_serialize( + validation_rule_id=validation_rule_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_validation_rule_assignment_without_preload_content( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + assignment_id: Annotated[StrictStr, Field(description="A unique validation rule assignment ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Validation Rule Assignment + + This method deletes a validation rule assignment. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: str + :param assignment_id: A unique validation rule assignment ID. (required) + :type assignment_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_validation_rule_assignment_serialize( + validation_rule_id=validation_rule_id, + assignment_id=assignment_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_validation_rule_assignment_serialize( + self, + validation_rule_id, + assignment_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if validation_rule_id is not None: + _path_params['validationRuleId'] = validation_rule_id + if assignment_id is not None: + _path_params['assignmentId'] = assignment_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_validation_rules( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Validation Rule + + This method deletes a validation rule. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_validation_rules_serialize( + validation_rule_id=validation_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_validation_rules_with_http_info( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Validation Rule + + This method deletes a validation rule. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_validation_rules_serialize( + validation_rule_id=validation_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_validation_rules_without_preload_content( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Validation Rule + + This method deletes a validation rule. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_validation_rules_serialize( + validation_rule_id=validation_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_validation_rules_serialize( + self, + validation_rule_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if validation_rule_id is not None: + _path_params['validationRuleId'] = validation_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/validation-rules/{validationRuleId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_validation_rule( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationRulesGetResponseBody: + """Get Validation Rule + + Retrieve the details of a validation rule. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_validation_rule_serialize( + validation_rule_id=validation_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_validation_rule_with_http_info( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationRulesGetResponseBody]: + """Get Validation Rule + + Retrieve the details of a validation rule. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_validation_rule_serialize( + validation_rule_id=validation_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_validation_rule_without_preload_content( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Validation Rule + + Retrieve the details of a validation rule. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_validation_rule_serialize( + validation_rule_id=validation_rule_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_validation_rule_serialize( + self, + validation_rule_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if validation_rule_id is not None: + _path_params['validationRuleId'] = validation_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/validation-rules/{validationRuleId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_validation_rule_assignments( + self, + validation_rule_id: Annotated[StrictStr, Field(description="Unique validation rule ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListValidationRuleAssignments], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationRulesAssignmentsListResponseBody: + """List Validation Rule Assignments + + Retrieve validation rule assignments for a specific validation rule. + + :param validation_rule_id: Unique validation rule ID. (required) + :type validation_rule_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListValidationRuleAssignments + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rule_assignments_serialize( + validation_rule_id=validation_rule_id, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_validation_rule_assignments_with_http_info( + self, + validation_rule_id: Annotated[StrictStr, Field(description="Unique validation rule ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListValidationRuleAssignments], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationRulesAssignmentsListResponseBody]: + """List Validation Rule Assignments + + Retrieve validation rule assignments for a specific validation rule. + + :param validation_rule_id: Unique validation rule ID. (required) + :type validation_rule_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListValidationRuleAssignments + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rule_assignments_serialize( + validation_rule_id=validation_rule_id, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_validation_rule_assignments_without_preload_content( + self, + validation_rule_id: Annotated[StrictStr, Field(description="Unique validation rule ID.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListValidationRuleAssignments], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Validation Rule Assignments + + Retrieve validation rule assignments for a specific validation rule. + + :param validation_rule_id: Unique validation rule ID. (required) + :type validation_rule_id: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListValidationRuleAssignments + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rule_assignments_serialize( + validation_rule_id=validation_rule_id, + limit=limit, + page=page, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_validation_rule_assignments_serialize( + self, + validation_rule_id, + limit, + page, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if validation_rule_id is not None: + _path_params['validationRuleId'] = validation_rule_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/validation-rules/{validationRuleId}/assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_validation_rules( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListValidationRules], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must start on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationRulesListResponseBody: + """List Validation Rules + + Retrieve validation rules. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListValidationRules + :param start_date: Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rules_serialize( + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_validation_rules_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListValidationRules], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must start on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationRulesListResponseBody]: + """List Validation Rules + + Retrieve validation rules. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListValidationRules + :param start_date: Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rules_serialize( + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_validation_rules_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + order: Annotated[Optional[ParameterOrderListValidationRules], Field(description="This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + start_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must start on. Represented in ISO 8601 format.")] = None, + end_date: Annotated[Optional[datetime], Field(description="Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Validation Rules + + Retrieve validation rules. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param order: This is a property that controls the sorting direction of the results. Sort the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListValidationRules + :param start_date: Timestamp representing the date and time which results must start on. Represented in ISO 8601 format. + :type start_date: datetime + :param end_date: Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. + :type end_date: datetime + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rules_serialize( + limit=limit, + page=page, + order=order, + start_date=start_date, + end_date=end_date, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_validation_rules_serialize( + self, + limit, + page, + order, + start_date, + end_date, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if start_date is not None: + if isinstance(start_date, datetime): + _query_params.append( + ( + 'start_date', + start_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('start_date', start_date)) + + if end_date is not None: + if isinstance(end_date, datetime): + _query_params.append( + ( + 'end_date', + end_date.strftime( + self.api_client.configuration.datetime_format + ) + ) + ) + else: + _query_params.append(('end_date', end_date)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/validation-rules', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_validation_rules_assignments( + self, + related_object_id: Annotated[Optional[StrictStr], Field(description="The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution.")] = None, + rule: Annotated[Optional[StrictStr], Field(description="Validation rule ID.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[StrictStr], Field(description="Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationRulesAssignmentsListResponseBody: + """List Validation Rules' Assignment(s) + + List all validation rules assignments or filter the results using the related object ID or the validation rule ID query parameters. # How to retrieve specific validation rule assignments(s) ## Related object ID To find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. ## Validation rule ID You can use the validation rule ID to find assignment(s) for a specific validation rule. + + :param related_object_id: The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. + :type related_object_id: str + :param rule: Validation rule ID. + :type rule: str + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. + :type order: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rules_assignments_serialize( + related_object_id=related_object_id, + rule=rule, + page=page, + limit=limit, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_validation_rules_assignments_with_http_info( + self, + related_object_id: Annotated[Optional[StrictStr], Field(description="The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution.")] = None, + rule: Annotated[Optional[StrictStr], Field(description="Validation rule ID.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[StrictStr], Field(description="Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationRulesAssignmentsListResponseBody]: + """List Validation Rules' Assignment(s) + + List all validation rules assignments or filter the results using the related object ID or the validation rule ID query parameters. # How to retrieve specific validation rule assignments(s) ## Related object ID To find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. ## Validation rule ID You can use the validation rule ID to find assignment(s) for a specific validation rule. + + :param related_object_id: The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. + :type related_object_id: str + :param rule: Validation rule ID. + :type rule: str + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. + :type order: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rules_assignments_serialize( + related_object_id=related_object_id, + rule=rule, + page=page, + limit=limit, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_validation_rules_assignments_without_preload_content( + self, + related_object_id: Annotated[Optional[StrictStr], Field(description="The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution.")] = None, + rule: Annotated[Optional[StrictStr], Field(description="Validation rule ID.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[StrictStr], Field(description="Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Validation Rules' Assignment(s) + + List all validation rules assignments or filter the results using the related object ID or the validation rule ID query parameters. # How to retrieve specific validation rule assignments(s) ## Related object ID To find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. ## Validation rule ID You can use the validation rule ID to find assignment(s) for a specific validation rule. + + :param related_object_id: The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution. + :type related_object_id: str + :param rule: Validation rule ID. + :type rule: str + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options: -created_at, created_at, where the dash - preceding a sorting option means sorting in a descending order. + :type order: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_validation_rules_assignments_serialize( + related_object_id=related_object_id, + rule=rule, + page=page, + limit=limit, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesAssignmentsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_validation_rules_assignments_serialize( + self, + related_object_id, + rule, + page, + limit, + order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if related_object_id is not None: + + _query_params.append(('related_object_id', related_object_id)) + + if rule is not None: + + _query_params.append(('rule', rule)) + + if page is not None: + + _query_params.append(('page', page)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/validation-rules-assignments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_validation_rule( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + validation_rules_update_request_body: Annotated[Optional[ValidationRulesUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationRulesUpdateResponseBody: + """Update Validation Rule + + Update validation rule parameters. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: str + :param validation_rules_update_request_body: Specify the parameters to be updated. + :type validation_rules_update_request_body: ValidationRulesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_validation_rule_serialize( + validation_rule_id=validation_rule_id, + validation_rules_update_request_body=validation_rules_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_validation_rule_with_http_info( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + validation_rules_update_request_body: Annotated[Optional[ValidationRulesUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationRulesUpdateResponseBody]: + """Update Validation Rule + + Update validation rule parameters. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: str + :param validation_rules_update_request_body: Specify the parameters to be updated. + :type validation_rules_update_request_body: ValidationRulesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_validation_rule_serialize( + validation_rule_id=validation_rule_id, + validation_rules_update_request_body=validation_rules_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_validation_rule_without_preload_content( + self, + validation_rule_id: Annotated[StrictStr, Field(description="A unique validation rule ID.")], + validation_rules_update_request_body: Annotated[Optional[ValidationRulesUpdateRequestBody], Field(description="Specify the parameters to be updated.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Validation Rule + + Update validation rule parameters. + + :param validation_rule_id: A unique validation rule ID. (required) + :type validation_rule_id: str + :param validation_rules_update_request_body: Specify the parameters to be updated. + :type validation_rules_update_request_body: ValidationRulesUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_validation_rule_serialize( + validation_rule_id=validation_rule_id, + validation_rules_update_request_body=validation_rules_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationRulesUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_validation_rule_serialize( + self, + validation_rule_id, + validation_rules_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if validation_rule_id is not None: + _path_params['validationRuleId'] = validation_rule_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if validation_rules_update_request_body is not None: + _body_params = validation_rules_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/validation-rules/{validationRuleId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/validations_api.py b/voucherify/api/validations_api.py new file mode 100644 index 00000000..90929143 --- /dev/null +++ b/voucherify/api/validations_api.py @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from typing import Optional +from voucherify.models.validations_validate_request_body import ValidationsValidateRequestBody +from voucherify.models.validations_validate_response_body import ValidationsValidateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class ValidationsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def validate_stacked_discounts( + self, + validations_validate_request_body: Optional[ValidationsValidateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ValidationsValidateResponseBody: + """Validate Stackable Discounts + + Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys. + + :param validations_validate_request_body: + :type validations_validate_request_body: ValidationsValidateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._validate_stacked_discounts_serialize( + validations_validate_request_body=validations_validate_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationsValidateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def validate_stacked_discounts_with_http_info( + self, + validations_validate_request_body: Optional[ValidationsValidateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ValidationsValidateResponseBody]: + """Validate Stackable Discounts + + Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys. + + :param validations_validate_request_body: + :type validations_validate_request_body: ValidationsValidateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._validate_stacked_discounts_serialize( + validations_validate_request_body=validations_validate_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationsValidateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def validate_stacked_discounts_without_preload_content( + self, + validations_validate_request_body: Optional[ValidationsValidateRequestBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Validate Stackable Discounts + + Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys. + + :param validations_validate_request_body: + :type validations_validate_request_body: ValidationsValidateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._validate_stacked_discounts_serialize( + validations_validate_request_body=validations_validate_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "ValidationsValidateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _validate_stacked_discounts_serialize( + self, + validations_validate_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if validations_validate_request_body is not None: + _body_params = validations_validate_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/validations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api/vouchers_api.py b/voucherify/api/vouchers_api.py new file mode 100644 index 00000000..a50a5f96 --- /dev/null +++ b/voucherify/api/vouchers_api.py @@ -0,0 +1,4644 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictBytes, StrictStr +from typing import Any, Dict, List, Optional, Union +from typing_extensions import Annotated +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_order_list_transactions import ParameterOrderListTransactions +from voucherify.models.parameter_order_vouchers import ParameterOrderVouchers +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter +from voucherify.models.vouchers_balance_update_request_body import VouchersBalanceUpdateRequestBody +from voucherify.models.vouchers_balance_update_response_body import VouchersBalanceUpdateResponseBody +from voucherify.models.vouchers_create_response_body import VouchersCreateResponseBody +from voucherify.models.vouchers_create_with_specific_code_request_body import VouchersCreateWithSpecificCodeRequestBody +from voucherify.models.vouchers_disable_response_body import VouchersDisableResponseBody +from voucherify.models.vouchers_enable_response_body import VouchersEnableResponseBody +from voucherify.models.vouchers_get_response_body import VouchersGetResponseBody +from voucherify.models.vouchers_import_create_item_request_body import VouchersImportCreateItemRequestBody +from voucherify.models.vouchers_import_create_response_body import VouchersImportCreateResponseBody +from voucherify.models.vouchers_import_csv_create_response_body import VouchersImportCsvCreateResponseBody +from voucherify.models.vouchers_list_response_body import VouchersListResponseBody +from voucherify.models.vouchers_metadata_update_in_bulk_request_body import VouchersMetadataUpdateInBulkRequestBody +from voucherify.models.vouchers_metadata_update_in_bulk_response_body import VouchersMetadataUpdateInBulkResponseBody +from voucherify.models.vouchers_transactions_export_create_request_body import VouchersTransactionsExportCreateRequestBody +from voucherify.models.vouchers_transactions_export_create_response_body import VouchersTransactionsExportCreateResponseBody +from voucherify.models.vouchers_transactions_list_response_body import VouchersTransactionsListResponseBody +from voucherify.models.vouchers_update_in_bulk_item_request_body import VouchersUpdateInBulkItemRequestBody +from voucherify.models.vouchers_update_in_bulk_response_body import VouchersUpdateInBulkResponseBody +from voucherify.models.vouchers_update_request_body import VouchersUpdateRequestBody +from voucherify.models.vouchers_update_response_body import VouchersUpdateResponseBody + +from voucherify.api_client import ApiClient, RequestSerialized +from voucherify.api_response import ApiResponse +from voucherify.rest import RESTResponseType + + +class VouchersApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_voucher( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + vouchers_create_with_specific_code_request_body: Annotated[Optional[VouchersCreateWithSpecificCodeRequestBody], Field(description="Specify the details of the voucher that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersCreateResponseBody: + """Create Voucher + + Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param vouchers_create_with_specific_code_request_body: Specify the details of the voucher that you would like to create. + :type vouchers_create_with_specific_code_request_body: VouchersCreateWithSpecificCodeRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_voucher_serialize( + code=code, + vouchers_create_with_specific_code_request_body=vouchers_create_with_specific_code_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_voucher_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + vouchers_create_with_specific_code_request_body: Annotated[Optional[VouchersCreateWithSpecificCodeRequestBody], Field(description="Specify the details of the voucher that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersCreateResponseBody]: + """Create Voucher + + Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param vouchers_create_with_specific_code_request_body: Specify the details of the voucher that you would like to create. + :type vouchers_create_with_specific_code_request_body: VouchersCreateWithSpecificCodeRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_voucher_serialize( + code=code, + vouchers_create_with_specific_code_request_body=vouchers_create_with_specific_code_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_voucher_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + vouchers_create_with_specific_code_request_body: Annotated[Optional[VouchersCreateWithSpecificCodeRequestBody], Field(description="Specify the details of the voucher that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Voucher + + Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param vouchers_create_with_specific_code_request_body: Specify the details of the voucher that you would like to create. + :type vouchers_create_with_specific_code_request_body: VouchersCreateWithSpecificCodeRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_voucher_serialize( + code=code, + vouchers_create_with_specific_code_request_body=vouchers_create_with_specific_code_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_voucher_serialize( + self, + code, + vouchers_create_with_specific_code_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if vouchers_create_with_specific_code_request_body is not None: + _body_params = vouchers_create_with_specific_code_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/{code}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_voucher( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Voucher + + Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param force: If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_voucher_serialize( + code=code, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_voucher_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Voucher + + Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param force: If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_voucher_serialize( + code=code, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_voucher_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + force: Annotated[Optional[StrictBool], Field(description="If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Voucher + + Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the voucher will be moved to the bin. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param force: If this flag is set to true, the voucher will be removed permanently. If it is set to false or not set at all, the voucher will be moved to the bin. Going forward, the user will be able to create another voucher with exactly the same code. + :type force: bool + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_voucher_serialize( + code=code, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_voucher_serialize( + self, + code, + force, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + if force is not None: + + _query_params.append(('force', force)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/vouchers/{code}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def disable_voucher( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersDisableResponseBody: + """Disable Voucher + + There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ This method sets the voucher state to **inactive**. The voucher cannot be redeemed. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def disable_voucher_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersDisableResponseBody]: + """Disable Voucher + + There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ This method sets the voucher state to **inactive**. The voucher cannot be redeemed. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def disable_voucher_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disable Voucher + + There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ This method sets the voucher state to **inactive**. The voucher cannot be redeemed. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._disable_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersDisableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _disable_voucher_serialize( + self, + code, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/{code}/disable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def enable_voucher( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersEnableResponseBody: + """Enable Voucher + + There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ The method sets the voucher state to **active**. The voucher can be redeemed - only if the redemption occurs after the start date and the voucher is not expired. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def enable_voucher_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersEnableResponseBody]: + """Enable Voucher + + There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ The method sets the voucher state to **active**. The voucher can be redeemed - only if the redemption occurs after the start date and the voucher is not expired. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def enable_voucher_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enable Voucher + + There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. ___ The method sets the voucher state to **active**. The voucher can be redeemed - only if the redemption occurs after the start date and the voucher is not expired. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._enable_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersEnableResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _enable_voucher_serialize( + self, + code, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/{code}/enable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def export_voucher_transactions( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + vouchers_transactions_export_create_request_body: Annotated[Optional[VouchersTransactionsExportCreateRequestBody], Field(description="Specify the parameters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersTransactionsExportCreateResponseBody: + """Export Voucher Transactions + + Export transactions that are associated with credit movements on a gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param vouchers_transactions_export_create_request_body: Specify the parameters for the transaction export. + :type vouchers_transactions_export_create_request_body: VouchersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_voucher_transactions_serialize( + code=code, + vouchers_transactions_export_create_request_body=vouchers_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def export_voucher_transactions_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + vouchers_transactions_export_create_request_body: Annotated[Optional[VouchersTransactionsExportCreateRequestBody], Field(description="Specify the parameters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersTransactionsExportCreateResponseBody]: + """Export Voucher Transactions + + Export transactions that are associated with credit movements on a gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param vouchers_transactions_export_create_request_body: Specify the parameters for the transaction export. + :type vouchers_transactions_export_create_request_body: VouchersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_voucher_transactions_serialize( + code=code, + vouchers_transactions_export_create_request_body=vouchers_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def export_voucher_transactions_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + vouchers_transactions_export_create_request_body: Annotated[Optional[VouchersTransactionsExportCreateRequestBody], Field(description="Specify the parameters for the transaction export.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Export Voucher Transactions + + Export transactions that are associated with credit movements on a gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param vouchers_transactions_export_create_request_body: Specify the parameters for the transaction export. + :type vouchers_transactions_export_create_request_body: VouchersTransactionsExportCreateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._export_voucher_transactions_serialize( + code=code, + vouchers_transactions_export_create_request_body=vouchers_transactions_export_create_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersTransactionsExportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_voucher_transactions_serialize( + self, + code, + vouchers_transactions_export_create_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if vouchers_transactions_export_create_request_body is not None: + _body_params = vouchers_transactions_export_create_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/{code}/transactions/export', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def generate_random_code( + self, + body: Annotated[Optional[Dict[str, Any]], Field(description="Specify the details of the voucher that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersCreateResponseBody: + """Generate Random Code + + Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + + :param body: Specify the details of the voucher that you would like to create. + :type body: object + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._generate_random_code_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def generate_random_code_with_http_info( + self, + body: Annotated[Optional[Dict[str, Any]], Field(description="Specify the details of the voucher that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersCreateResponseBody]: + """Generate Random Code + + Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + + :param body: Specify the details of the voucher that you would like to create. + :type body: object + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._generate_random_code_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def generate_random_code_without_preload_content( + self, + body: Annotated[Optional[Dict[str, Any]], Field(description="Specify the details of the voucher that you would like to create.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Generate Random Code + + Create a standalone voucher. You can choose to create a GIFT_VOUCHER, a DISCOUNT_VOUCHER, or a LOYALTY_CARD. When you create a new voucher, you can specify a type to create it. Creating a new voucher will create a new stand alone voucher if no campaign name or campaign_id is provided. In case of the loyalty card, a campaign name is required. You can optionally use the code parameter to define a specific code or the code_config parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API. This method will return an error when trying to create a voucher that already exists. + + :param body: Specify the details of the voucher that you would like to create. + :type body: object + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._generate_random_code_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _generate_random_code_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_voucher( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersGetResponseBody: + """Get Voucher + + Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_voucher_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersGetResponseBody]: + """Get Voucher + + Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_voucher_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Voucher + + Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_voucher_serialize( + code=code, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersGetResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_voucher_serialize( + self, + code, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/vouchers/{code}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_vouchers( + self, + vouchers_import_create_item_request_body: Annotated[List[VouchersImportCreateItemRequestBody], Field(description="The request body is an array of objects. Each object contains details about a specific voucher. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersImportCreateResponseBody: + """Import Vouchers + + Import standalone vouchers and gift cards into the repository. ๐Ÿ“˜ Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param vouchers_import_create_item_request_body: The request body is an array of objects. Each object contains details about a specific voucher. (required) + :type vouchers_import_create_item_request_body: List[VouchersImportCreateItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_serialize( + vouchers_import_create_item_request_body=vouchers_import_create_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_vouchers_with_http_info( + self, + vouchers_import_create_item_request_body: Annotated[List[VouchersImportCreateItemRequestBody], Field(description="The request body is an array of objects. Each object contains details about a specific voucher. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersImportCreateResponseBody]: + """Import Vouchers + + Import standalone vouchers and gift cards into the repository. ๐Ÿ“˜ Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param vouchers_import_create_item_request_body: The request body is an array of objects. Each object contains details about a specific voucher. (required) + :type vouchers_import_create_item_request_body: List[VouchersImportCreateItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_serialize( + vouchers_import_create_item_request_body=vouchers_import_create_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_vouchers_without_preload_content( + self, + vouchers_import_create_item_request_body: Annotated[List[VouchersImportCreateItemRequestBody], Field(description="The request body is an array of objects. Each object contains details about a specific voucher. ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import Vouchers + + Import standalone vouchers and gift cards into the repository. ๐Ÿ“˜ Important notes - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. Any parameters not provided in the payload will be left blank or null. For both **standalone discount vouchers and gift cards**, you can import the following fields: - code - category - active - type - start_date - expiration_date - redemption.quantity - additional_info - metadata For **gift cards**, you can also import the following field: - gift.amount For **discount vouchers**, you can import the discount object. The object will slightly vary depending on the type of discount. Each discount type **requires** the type to be defined in the import. Fields other than the ones listed above wont be imported. Even if provided, they will be silently skipped. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param vouchers_import_create_item_request_body: The request body is an array of objects. Each object contains details about a specific voucher. (required) + :type vouchers_import_create_item_request_body: List[VouchersImportCreateItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_serialize( + vouchers_import_create_item_request_body=vouchers_import_create_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersImportCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_vouchers_serialize( + self, + vouchers_import_create_item_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'VouchersImportCreateItemRequestBody': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if vouchers_import_create_item_request_body is not None: + _body_params = vouchers_import_create_item_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/import', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_vouchers_using_csv( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersImportCsvCreateResponseBody: + """Import Vouchers using CSV + + Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). ___ ๐Ÿ“˜ Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. ๐Ÿ“˜ Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_vouchers_using_csv_with_http_info( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersImportCsvCreateResponseBody]: + """Import Vouchers using CSV + + Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). ___ ๐Ÿ“˜ Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. ๐Ÿ“˜ Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_vouchers_using_csv_without_preload_content( + self, + file: Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="File path.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import Vouchers using CSV + + Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). ___ ๐Ÿ“˜ Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Custom code attributes (not supported by-default) need to be added as code **metadata**. - You **cannot import the same codes** to a single Voucherify Project. ๐Ÿ“˜ Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. + + :param file: File path. + :type file: bytearray + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_vouchers_using_csv_serialize( + file=file, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersImportCsvCreateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_vouchers_using_csv_serialize( + self, + file, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/importCSV', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_voucher_transactions( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersTransactionsListResponseBody: + """List Voucher Transactions + + List transactions that are associated with credit movements on a gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_voucher_transactions_serialize( + code=code, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_voucher_transactions_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersTransactionsListResponseBody]: + """List Voucher Transactions + + List transactions that are associated with credit movements on a gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_voucher_transactions_serialize( + code=code, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_voucher_transactions_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + order: Annotated[Optional[ParameterOrderListTransactions], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + starting_after_id: Annotated[Optional[StrictStr], Field(description="A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Voucher Transactions + + List transactions that are associated with credit movements on a gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderListTransactions + :param starting_after_id: A cursor for pagination. It retrieves the transactions starting after a transaction with the given ID. + :type starting_after_id: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_voucher_transactions_serialize( + code=code, + limit=limit, + order=order, + starting_after_id=starting_after_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersTransactionsListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_voucher_transactions_serialize( + self, + code, + limit, + order, + starting_after_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if starting_after_id is not None: + + _query_params.append(('starting_after_id', starting_after_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/vouchers/{code}/transactions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_vouchers( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + category: Annotated[Optional[StrictStr], Field(description="Limit search results to vouchers within the specified category.")] = None, + campaign_id: Annotated[Optional[StrictStr], Field(description="Limit search results to vouchers within the specified campaign")] = None, + customer: Annotated[Optional[StrictStr], Field(description="A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="A unique campaign name, identifies the parent campaign.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + order: Annotated[Optional[ParameterOrderVouchers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + code: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersListResponseBody: + """List Vouchers + + Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param category: Limit search results to vouchers within the specified category. + :type category: str + :param campaign_id: Limit search results to vouchers within the specified campaign + :type campaign_id: str + :param customer: A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + :type customer: str + :param campaign: A unique campaign name, identifies the parent campaign. + :type campaign: str + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderVouchers + :param code: + :type code: str + :param ids: + :type ids: List[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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_vouchers_serialize( + limit=limit, + page=page, + category=category, + campaign_id=campaign_id, + customer=customer, + campaign=campaign, + created_at=created_at, + updated_at=updated_at, + order=order, + code=code, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_vouchers_with_http_info( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + category: Annotated[Optional[StrictStr], Field(description="Limit search results to vouchers within the specified category.")] = None, + campaign_id: Annotated[Optional[StrictStr], Field(description="Limit search results to vouchers within the specified campaign")] = None, + customer: Annotated[Optional[StrictStr], Field(description="A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="A unique campaign name, identifies the parent campaign.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + order: Annotated[Optional[ParameterOrderVouchers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + code: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersListResponseBody]: + """List Vouchers + + Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param category: Limit search results to vouchers within the specified category. + :type category: str + :param campaign_id: Limit search results to vouchers within the specified campaign + :type campaign_id: str + :param customer: A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + :type customer: str + :param campaign: A unique campaign name, identifies the parent campaign. + :type campaign: str + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderVouchers + :param code: + :type code: str + :param ids: + :type ids: List[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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_vouchers_serialize( + limit=limit, + page=page, + category=category, + campaign_id=campaign_id, + customer=customer, + campaign=campaign, + created_at=created_at, + updated_at=updated_at, + order=order, + code=code, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_vouchers_without_preload_content( + self, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.")] = None, + page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Which page of results to return. The lowest value is 1.")] = None, + category: Annotated[Optional[StrictStr], Field(description="Limit search results to vouchers within the specified category.")] = None, + campaign_id: Annotated[Optional[StrictStr], Field(description="Limit search results to vouchers within the specified campaign")] = None, + customer: Annotated[Optional[StrictStr], Field(description="A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters.")] = None, + campaign: Annotated[Optional[StrictStr], Field(description="A unique campaign name, identifies the parent campaign.")] = None, + created_at: Annotated[Optional[ParameterCreatedBeforeAfter], Field(description="A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z")] = None, + updated_at: Annotated[Optional[ParameterUpdatedBeforeAfter], Field(description="A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z")] = None, + order: Annotated[Optional[ParameterOrderVouchers], Field(description="Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.")] = None, + code: Optional[StrictStr] = None, + ids: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Vouchers + + Returns a list of vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 100 vouchers are returned in the response. When you get a list of vouchers, you can optionally specify query parameters to customize the number of vouchers returned per call using limit, which page of vouchers to return using page, sort the vouchers using the order query parameter and more. This method will return an error when trying to return a limit of more than 100 vouchers. + + :param limit: Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. + :type limit: int + :param page: Which page of results to return. The lowest value is 1. + :type page: int + :param category: Limit search results to vouchers within the specified category. + :type category: str + :param campaign_id: Limit search results to vouchers within the specified campaign + :type campaign_id: str + :param customer: A tracking identifier of a customer who is the holder of the vouchers. It can be an id generated by Voucherify or the source_id. Remember to use the proper URL escape codes if the source_id contains special characters. + :type customer: str + :param campaign: A unique campaign name, identifies the parent campaign. + :type campaign: str + :param created_at: A filter on the list based on the object created_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [created_at][before] 2017-09-08T13:52:18.227Z + :type created_at: ParameterCreatedBeforeAfter + :param updated_at: A filter on the list based on the object updated_at field. The value is a dictionary with the following options: before, after. A date value must be presented in ISO 8601 format (2016-11-16T14:14:31Z or 2016-11-16). An example: [updated_at][before] 2017-09-08T13:52:18.227Z + :type updated_at: ParameterUpdatedBeforeAfter + :param order: Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. + :type order: ParameterOrderVouchers + :param code: + :type code: str + :param ids: + :type ids: List[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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_vouchers_serialize( + limit=limit, + page=page, + category=category, + campaign_id=campaign_id, + customer=customer, + campaign=campaign, + created_at=created_at, + updated_at=updated_at, + order=order, + code=code, + ids=ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersListResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_vouchers_serialize( + self, + limit, + page, + category, + campaign_id, + customer, + campaign, + created_at, + updated_at, + order, + code, + ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'ids': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if page is not None: + + _query_params.append(('page', page)) + + if category is not None: + + _query_params.append(('category', category)) + + if campaign_id is not None: + + _query_params.append(('campaign_id', campaign_id)) + + if customer is not None: + + _query_params.append(('customer', customer)) + + if campaign is not None: + + _query_params.append(('campaign', campaign)) + + if created_at is not None: + + _query_params.append(('created_at', created_at)) + + if updated_at is not None: + + _query_params.append(('updated_at', updated_at)) + + if order is not None: + + _query_params.append(('order', order.value)) + + if code is not None: + + _query_params.append(('code', code)) + + if ids is not None: + + _query_params.append(('ids', ids)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/vouchers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def release_validation_session( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.")], + session_key: Annotated[StrictStr, Field(description="A unique session identifier.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Release Validation Session + + Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. ๐Ÿ“˜ Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations). + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + :type code: str + :param session_key: A unique session identifier. (required) + :type session_key: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._release_validation_session_serialize( + code=code, + session_key=session_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def release_validation_session_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.")], + session_key: Annotated[StrictStr, Field(description="A unique session identifier.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Release Validation Session + + Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. ๐Ÿ“˜ Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations). + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + :type code: str + :param session_key: A unique session identifier. (required) + :type session_key: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._release_validation_session_serialize( + code=code, + session_key=session_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def release_validation_session_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.")], + session_key: Annotated[StrictStr, Field(description="A unique session identifier.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Release Validation Session + + Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. ๐Ÿ“˜ Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations). + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify. (required) + :type code: str + :param session_key: A unique session identifier. (required) + :type session_key: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._release_validation_session_serialize( + code=code, + session_key=session_key, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _release_validation_session_serialize( + self, + code, + session_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + if session_key is not None: + _path_params['sessionKey'] = session_key + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/vouchers/{code}/sessions/{sessionKey}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_voucher( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + vouchers_update_request_body: Annotated[VouchersUpdateRequestBody, Field(description="Specify the parameters to be updated.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersUpdateResponseBody: + """Update Voucher + + Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param vouchers_update_request_body: Specify the parameters to be updated. (required) + :type vouchers_update_request_body: VouchersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_voucher_serialize( + code=code, + vouchers_update_request_body=vouchers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_voucher_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + vouchers_update_request_body: Annotated[VouchersUpdateRequestBody, Field(description="Specify the parameters to be updated.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersUpdateResponseBody]: + """Update Voucher + + Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param vouchers_update_request_body: Specify the parameters to be updated. (required) + :type vouchers_update_request_body: VouchersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_voucher_serialize( + code=code, + vouchers_update_request_body=vouchers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_voucher_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A unique **code** that identifies the voucher.")], + vouchers_update_request_body: Annotated[VouchersUpdateRequestBody, Field(description="Specify the parameters to be updated.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Voucher + + Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body wont be modified. Even if provided, they will be silently skipped. + + :param code: A unique **code** that identifies the voucher. (required) + :type code: str + :param vouchers_update_request_body: Specify the parameters to be updated. (required) + :type vouchers_update_request_body: VouchersUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_voucher_serialize( + code=code, + vouchers_update_request_body=vouchers_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_voucher_serialize( + self, + code, + vouchers_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if vouchers_update_request_body is not None: + _body_params = vouchers_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/vouchers/{code}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_voucher_balance( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + vouchers_balance_update_request_body: Annotated[VouchersBalanceUpdateRequestBody, Field(description="Provide the amount to be added to/subtracted from the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersBalanceUpdateResponseBody: + """Add or Remove Voucher Balance + + Add balance to an existing gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param vouchers_balance_update_request_body: Provide the amount to be added to/subtracted from the voucher. (required) + :type vouchers_balance_update_request_body: VouchersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_voucher_balance_serialize( + code=code, + vouchers_balance_update_request_body=vouchers_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_voucher_balance_with_http_info( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + vouchers_balance_update_request_body: Annotated[VouchersBalanceUpdateRequestBody, Field(description="Provide the amount to be added to/subtracted from the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersBalanceUpdateResponseBody]: + """Add or Remove Voucher Balance + + Add balance to an existing gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param vouchers_balance_update_request_body: Provide the amount to be added to/subtracted from the voucher. (required) + :type vouchers_balance_update_request_body: VouchersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_voucher_balance_serialize( + code=code, + vouchers_balance_update_request_body=vouchers_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_voucher_balance_without_preload_content( + self, + code: Annotated[StrictStr, Field(description="A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u.")], + vouchers_balance_update_request_body: Annotated[VouchersBalanceUpdateRequestBody, Field(description="Provide the amount to be added to/subtracted from the voucher.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add or Remove Voucher Balance + + Add balance to an existing gift card or loyalty card. + + :param code: A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u. (required) + :type code: str + :param vouchers_balance_update_request_body: Provide the amount to be added to/subtracted from the voucher. (required) + :type vouchers_balance_update_request_body: VouchersBalanceUpdateRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_voucher_balance_serialize( + code=code, + vouchers_balance_update_request_body=vouchers_balance_update_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersBalanceUpdateResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_voucher_balance_serialize( + self, + code, + vouchers_balance_update_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if code is not None: + _path_params['code'] = code + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if vouchers_balance_update_request_body is not None: + _body_params = vouchers_balance_update_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/{code}/balance', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_vouchers_in_bulk( + self, + vouchers_update_in_bulk_item_request_body: Annotated[List[VouchersUpdateInBulkItemRequestBody], Field(description="List the codes to be updated with the metadata key/value pairs for that code.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersUpdateInBulkResponseBody: + """Update Vouchers in Bulk + + Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. ๐Ÿšง Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param vouchers_update_in_bulk_item_request_body: List the codes to be updated with the metadata key/value pairs for that code. (required) + :type vouchers_update_in_bulk_item_request_body: List[VouchersUpdateInBulkItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vouchers_in_bulk_serialize( + vouchers_update_in_bulk_item_request_body=vouchers_update_in_bulk_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_vouchers_in_bulk_with_http_info( + self, + vouchers_update_in_bulk_item_request_body: Annotated[List[VouchersUpdateInBulkItemRequestBody], Field(description="List the codes to be updated with the metadata key/value pairs for that code.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersUpdateInBulkResponseBody]: + """Update Vouchers in Bulk + + Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. ๐Ÿšง Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param vouchers_update_in_bulk_item_request_body: List the codes to be updated with the metadata key/value pairs for that code. (required) + :type vouchers_update_in_bulk_item_request_body: List[VouchersUpdateInBulkItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vouchers_in_bulk_serialize( + vouchers_update_in_bulk_item_request_body=vouchers_update_in_bulk_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_vouchers_in_bulk_without_preload_content( + self, + vouchers_update_in_bulk_item_request_body: Annotated[List[VouchersUpdateInBulkItemRequestBody], Field(description="List the codes to be updated with the metadata key/value pairs for that code.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Vouchers in Bulk + + Updates specific metadata parameters for each code, respectively, in one asynchronous operation. The request can include up to **10 MB** of data. Upserts are not supported. ๐Ÿšง Currently, only **metadata** updates are supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param vouchers_update_in_bulk_item_request_body: List the codes to be updated with the metadata key/value pairs for that code. (required) + :type vouchers_update_in_bulk_item_request_body: List[VouchersUpdateInBulkItemRequestBody] + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vouchers_in_bulk_serialize( + vouchers_update_in_bulk_item_request_body=vouchers_update_in_bulk_item_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_vouchers_in_bulk_serialize( + self, + vouchers_update_in_bulk_item_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'VouchersUpdateInBulkItemRequestBody': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if vouchers_update_in_bulk_item_request_body is not None: + _body_params = vouchers_update_in_bulk_item_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/bulk/async', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_vouchers_metadata_in_bulk( + self, + vouchers_metadata_update_in_bulk_request_body: Annotated[VouchersMetadataUpdateInBulkRequestBody, Field(description="List the codes of the vouchers you would like to update with the metadata key/value pairs.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VouchersMetadataUpdateInBulkResponseBody: + """Update Vouchers' Metadata in Bulk + + Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param vouchers_metadata_update_in_bulk_request_body: List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + :type vouchers_metadata_update_in_bulk_request_body: VouchersMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vouchers_metadata_in_bulk_serialize( + vouchers_metadata_update_in_bulk_request_body=vouchers_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_vouchers_metadata_in_bulk_with_http_info( + self, + vouchers_metadata_update_in_bulk_request_body: Annotated[VouchersMetadataUpdateInBulkRequestBody, Field(description="List the codes of the vouchers you would like to update with the metadata key/value pairs.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VouchersMetadataUpdateInBulkResponseBody]: + """Update Vouchers' Metadata in Bulk + + Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param vouchers_metadata_update_in_bulk_request_body: List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + :type vouchers_metadata_update_in_bulk_request_body: VouchersMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vouchers_metadata_in_bulk_serialize( + vouchers_metadata_update_in_bulk_request_body=vouchers_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_vouchers_metadata_in_bulk_without_preload_content( + self, + vouchers_metadata_update_in_bulk_request_body: Annotated[VouchersMetadataUpdateInBulkRequestBody, Field(description="List the codes of the vouchers you would like to update with the metadata key/value pairs.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Vouchers' Metadata in Bulk + + Updates metadata parameters for a list of codes. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. Upserts are not supported. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. + + :param vouchers_metadata_update_in_bulk_request_body: List the codes of the vouchers you would like to update with the metadata key/value pairs. (required) + :type vouchers_metadata_update_in_bulk_request_body: VouchersMetadataUpdateInBulkRequestBody + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_vouchers_metadata_in_bulk_serialize( + vouchers_metadata_update_in_bulk_request_body=vouchers_metadata_update_in_bulk_request_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '2XX': "VouchersMetadataUpdateInBulkResponseBody", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_vouchers_metadata_in_bulk_serialize( + self, + vouchers_metadata_update_in_bulk_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if vouchers_metadata_update_in_bulk_request_body is not None: + _body_params = vouchers_metadata_update_in_bulk_request_body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'X-App-Id', + 'X-App-Token' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/vouchers/metadata/async', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/voucherify/api_client.py b/voucherify/api_client.py new file mode 100644 index 00000000..b45a02b1 --- /dev/null +++ b/voucherify/api_client.py @@ -0,0 +1,792 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from voucherify.configuration import Configuration +from voucherify.api_response import ApiResponse, T as ApiResponseT +import voucherify.models +from voucherify import rest +from voucherify.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = { + "X-Voucherify-Channel": "Python-SDK", + "User-Agent": "OpenAPI-Python-SDK/3.0.0" + } + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Python-SDK/3.0.0' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + + elif isinstance(obj, dict): + obj_dict = obj + 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__ + + 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. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif content_type.startswith("application/json"): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif content_type.startswith("text/plain"): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(voucherify.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + elif klass == decimal.Decimal: + return decimal.Decimal(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, str(value)) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters(self, files: Dict[str, Union[str, bytes]]): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/voucherify/api_response.py b/voucherify/api_response.py new file mode 100644 index 00000000..9bc7c11f --- /dev/null +++ b/voucherify/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/voucherify/client.py b/voucherify/client.py deleted file mode 100644 index f4bc39ee..00000000 --- a/voucherify/client.py +++ /dev/null @@ -1,272 +0,0 @@ -import requests -import json - -try: - from urllib.parse import urlencode, quote -except ImportError: - from urllib import urlencode - from urllib import quote - -ENDPOINT_URL = 'https://api.voucherify.io' -TIMEOUT = 180 - - -class VoucherifyRequest(object): - def __init__(self, application_id, client_secret_key, api_endpoint=None, timeout=TIMEOUT): - self.timeout = timeout - self.url = (api_endpoint if api_endpoint else ENDPOINT_URL) + "/v1" - self.headers = { - 'X-App-Id': application_id, - 'X-App-Token': client_secret_key, - 'X-Voucherify-Channel': 'Python-SDK', - 'Content-Type': 'application/json' - } - - def request(self, path, method='GET', **kwargs): - try: - url = self.url + path - - response = requests.request( - method=method, - url=url, - headers=self.headers, - timeout=self.timeout, - **kwargs - ) - except requests.HTTPError as e: - response = json.loads(e.read()) - except requests.ConnectionError as e: - raise VoucherifyError(e) - - if response.headers.get('content-type') and 'json' in response.headers['content-type']: - result = response.json() - else: - result = response.text - - return result - - -class Vouchers(VoucherifyRequest): - def __init__(self, *args, **kwargs): - super(Vouchers, self).__init__(*args, **kwargs) - - def list(self, query): - path = '/vouchers/' - - return self.request( - path, - params=query - ) - - def get(self, code): - path = '/vouchers/' + quote(code) - - return self.request( - path - ) - - def create(self, voucher): - code = voucher.get('code', '') - path = '/vouchers/' + quote(code) - - return self.request( - path, - data=json.dumps(voucher), - method='POST' - ) - - def update(self, voucher_update): - path = '/vouchers/' + quote(voucher_update.get("code")) - - return self.request( - path, - data=json.dumps(voucher_update), - method='PUT' - ) - - def enable(self, code): - path = '/vouchers/' + quote(code) + '/enable' - - return self.request( - path, - method='POST' - ) - - def disable(self, code): - path = '/vouchers/' + quote(code) + '/disable' - - return self.request( - path, - method='POST' - ) - - def releaseValidationSession(self, code, sessionKey): - path = '/vouchers/' + quote(code) + '/sessions/' + quote(sessionKey) - - return self.request( - path, - method='DELETE' - ) - - -class Redemptions(VoucherifyRequest): - def __init__(self, *args, **kwargs): - super(Redemptions, self).__init__(*args, **kwargs) - - def redeem(self, code, tracking_id=None): - context = {} - - if code and isinstance(code, dict): - context = code - code = context['voucher'] - del context['voucher'] - - path = '/vouchers/' + quote(code) + '/redemption' - - if tracking_id: - path = path + '?' + urlencode({'tracking_id': tracking_id}) - - return self.request( - path, - method='POST', - data=json.dumps(context), - ) - - def redeemStackable(self, params): - path = '/redemptions' - - return self.request( - path, - method='POST', - data=json.dumps(params) - ) - - def getForVoucher(self, code): - path = '/vouchers/' + quote(code) + '/redemption' - - return self.request( - path - ) - - def list(self, query): - path = '/redemptions' - - return self.request( - path, - params=query - ) - - def rollback(self, redemption_id, reason=None): - path = '/redemptions/' + redemption_id + '/rollback' - - if reason: - path = path + '?' + urlencode({'reason': reason}) - - return self.request( - path, - method='POST' - ) - - -class Validations(VoucherifyRequest): - def __init__(self, *args, **kwargs): - super(Validations, self).__init__(*args, **kwargs) - - def validateVoucher(self, code, params): - path = '/vouchers/' + quote(code) + '/validate' - - return self.request( - path, - method='POST', - data=json.dumps(params), - ) - - def validateStackable(self, params): - path = '/validations' - - return self.request( - path, - method='POST', - data=json.dumps(params) - ) - - -class Distributions(VoucherifyRequest): - def __init__(self, *args, **kwargs): - super(Distributions, self).__init__(*args, **kwargs) - - def publish(self, params): - path = '/vouchers/publish' - - return self.request( - path, - method='POST', - data=json.dumps(params) - ) - - -class Customers(VoucherifyRequest): - def __init__(self, *args, **kwargs): - super(Customers, self).__init__(*args, **kwargs) - - def create(self, customer): - path = '/customers/' - - return self.request( - path, - data=json.dumps(customer), - method='POST' - ) - - def get(self, customer_id): - path = '/customers/' + quote(customer_id) - - return self.request( - path - ) - - def update(self, customer): - path = '/customers/' + quote(customer.get('id')) - - return self.request( - path, - data=json.dumps(customer), - method='PUT' - ) - - def delete(self, customer_id): - path = '/customers/' + quote(customer_id) - - return self.request( - path, - method='DELETE' - ) - - -class Client(VoucherifyRequest): - def __init__(self, *args, **kwargs): - super(Client, self).__init__(*args, **kwargs) - self.customers = Customers(*args, **kwargs) - self.vouchers = Vouchers(*args, **kwargs) - self.redemptions = Redemptions(*args, **kwargs) - self.validations = Validations(*args, **kwargs) - self.distributions = Distributions(*args, **kwargs) - - -class VoucherifyError(Exception): - def __init__(self, result): - self.result = result - self.code = None - self.message = None - - try: - self.type = result['error_code'] - self.message = result['error_msg'] - except: - self.type = '' - self.message = result - - Exception.__init__(self, self.message) - - -__all__ = ['Client'] diff --git a/voucherify/configuration.py b/voucherify/configuration.py new file mode 100644 index 00000000..953a30d7 --- /dev/null +++ b/voucherify/configuration.py @@ -0,0 +1,521 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import logging +from logging import FileHandler +import multiprocessing +import sys +from typing import Optional +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: Number of retries for API requests. + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = voucherify.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ignore_operation_servers=False, + ssl_ca_cert=None, + retries=None, + *, + debug: Optional[bool] = None + ) -> None: + """Constructor + """ + self._base_path = "https://api.voucherify.io" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("voucherify") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy: Optional[str] = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = retries + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if 'X-App-Id' in self.api_key: + auth['X-App-Id'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'X-App-Id', + 'value': self.get_api_key_with_prefix( + 'X-App-Id', + ), + } + if 'X-App-Token' in self.api_key: + auth['X-App-Token'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'X-App-Token', + 'value': self.get_api_key_with_prefix( + 'X-App-Token', + ), + } + if 'X-Client-Token' in self.api_key: + auth['X-Client-Token'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'X-Client-Token', + 'value': self.get_api_key_with_prefix( + 'X-Client-Token', + ), + } + if 'X-Client-Application-Id' in self.api_key: + auth['X-Client-Application-Id'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'X-Client-Application-Id', + 'value': self.get_api_key_with_prefix( + 'X-Client-Application-Id', + ), + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: v2018-08-01\n"\ + "SDK Package Version: 3.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://{cluster}.voucherify.io", + 'description': "Base URL", + 'variables': { + 'cluster': { + 'description': "No description provided", + 'default_value': "api", + 'enum_values': [ + "api", + "us1.api", + "as1.api", + "download", + "us1.download", + "as1.download" + ] + } + } + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/voucherify/exceptions.py b/voucherify/exceptions.py new file mode 100644 index 00000000..294d5926 --- /dev/null +++ b/voucherify/exceptions.py @@ -0,0 +1,200 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.getheaders() + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/voucherify/models/__init__.py b/voucherify/models/__init__.py new file mode 100644 index 00000000..3e6f9f50 --- /dev/null +++ b/voucherify/models/__init__.py @@ -0,0 +1,944 @@ +# coding: utf-8 + +# flake8: noqa +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +# import models into model package +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.applicable_to import ApplicableTo +from voucherify.models.applicable_to_effect import ApplicableToEffect +from voucherify.models.applicable_to_result_list import ApplicableToResultList +from voucherify.models.area_store_campaign_assignment import AreaStoreCampaignAssignment +from voucherify.models.async_action_base import AsyncActionBase +from voucherify.models.async_action_get_response_body import AsyncActionGetResponseBody +from voucherify.models.async_actions_list_response_body import AsyncActionsListResponseBody +from voucherify.models.bus_val_rule_assignment import BusValRuleAssignment +from voucherify.models.campaign_base import CampaignBase +from voucherify.models.campaign_loyalty_card import CampaignLoyaltyCard +from voucherify.models.campaign_loyalty_card_expiration_rules import CampaignLoyaltyCardExpirationRules +from voucherify.models.campaign_loyalty_voucher import CampaignLoyaltyVoucher +from voucherify.models.campaign_loyalty_voucher_redemption import CampaignLoyaltyVoucherRedemption +from voucherify.models.campaign_voucher import CampaignVoucher +from voucherify.models.campaign_voucher_redemption import CampaignVoucherRedemption +from voucherify.models.campaigns_create_request_body import CampaignsCreateRequestBody +from voucherify.models.campaigns_create_request_body_promotion import CampaignsCreateRequestBodyPromotion +from voucherify.models.campaigns_create_request_body_voucher import CampaignsCreateRequestBodyVoucher +from voucherify.models.campaigns_create_request_body_voucher_redemption import CampaignsCreateRequestBodyVoucherRedemption +from voucherify.models.campaigns_create_response_body import CampaignsCreateResponseBody +from voucherify.models.campaigns_delete_response_body import CampaignsDeleteResponseBody +from voucherify.models.campaigns_get_response_body import CampaignsGetResponseBody +from voucherify.models.campaigns_import_create_response_body import CampaignsImportCreateResponseBody +from voucherify.models.campaigns_import_csv_create_response_body import CampaignsImportCsvCreateResponseBody +from voucherify.models.campaigns_import_voucher_item import CampaignsImportVoucherItem +from voucherify.models.campaigns_import_voucher_item_redemption import CampaignsImportVoucherItemRedemption +from voucherify.models.campaigns_list_response_body import CampaignsListResponseBody +from voucherify.models.campaigns_update_request_body import CampaignsUpdateRequestBody +from voucherify.models.campaigns_update_request_body_options import CampaignsUpdateRequestBodyOptions +from voucherify.models.campaigns_update_response_body import CampaignsUpdateResponseBody +from voucherify.models.campaigns_vouchers_create_combined_response_body import CampaignsVouchersCreateCombinedResponseBody +from voucherify.models.campaigns_vouchers_create_combined_response_body_gift import CampaignsVouchersCreateCombinedResponseBodyGift +from voucherify.models.campaigns_vouchers_create_combined_response_body_loyalty_card import CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard +from voucherify.models.campaigns_vouchers_create_combined_response_body_publish import CampaignsVouchersCreateCombinedResponseBodyPublish +from voucherify.models.campaigns_vouchers_create_combined_response_body_redemption import CampaignsVouchersCreateCombinedResponseBodyRedemption +from voucherify.models.campaigns_vouchers_create_in_bulk_request_body import CampaignsVouchersCreateInBulkRequestBody +from voucherify.models.campaigns_vouchers_create_in_bulk_request_body_redemption import CampaignsVouchersCreateInBulkRequestBodyRedemption +from voucherify.models.campaigns_vouchers_create_request_body import CampaignsVouchersCreateRequestBody +from voucherify.models.campaigns_vouchers_create_request_body_redemption import CampaignsVouchersCreateRequestBodyRedemption +from voucherify.models.campaigns_vouchers_create_response_body import CampaignsVouchersCreateResponseBody +from voucherify.models.campaigns_vouchers_create_response_body_gift import CampaignsVouchersCreateResponseBodyGift +from voucherify.models.campaigns_vouchers_create_response_body_loyalty_card import CampaignsVouchersCreateResponseBodyLoyaltyCard +from voucherify.models.campaigns_vouchers_create_response_body_publish import CampaignsVouchersCreateResponseBodyPublish +from voucherify.models.campaigns_vouchers_create_response_body_redemption import CampaignsVouchersCreateResponseBodyRedemption +from voucherify.models.categories_create_request_body import CategoriesCreateRequestBody +from voucherify.models.categories_create_response_body import CategoriesCreateResponseBody +from voucherify.models.categories_get_response_body import CategoriesGetResponseBody +from voucherify.models.categories_list_response_body import CategoriesListResponseBody +from voucherify.models.categories_update_request_body import CategoriesUpdateRequestBody +from voucherify.models.categories_update_response_body import CategoriesUpdateResponseBody +from voucherify.models.category import Category +from voucherify.models.client_events_create_request_body import ClientEventsCreateRequestBody +from voucherify.models.client_events_create_request_body_loyalty import ClientEventsCreateRequestBodyLoyalty +from voucherify.models.client_events_create_request_body_referral import ClientEventsCreateRequestBodyReferral +from voucherify.models.client_events_create_response_body import ClientEventsCreateResponseBody +from voucherify.models.client_promotions_tiers_list_response_body import ClientPromotionsTiersListResponseBody +from voucherify.models.client_qualifications_check_eligibility_request_body import ClientQualificationsCheckEligibilityRequestBody +from voucherify.models.client_qualifications_check_eligibility_response_body import ClientQualificationsCheckEligibilityResponseBody +from voucherify.models.client_redemptions_redeem_request_body import ClientRedemptionsRedeemRequestBody +from voucherify.models.client_redemptions_redeem_request_body_options import ClientRedemptionsRedeemRequestBodyOptions +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item import ClientRedemptionsRedeemRequestBodyRedeemablesItem +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item_gift import ClientRedemptionsRedeemRequestBodyRedeemablesItemGift +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item_reward import ClientRedemptionsRedeemRequestBodyRedeemablesItemReward +from voucherify.models.client_redemptions_redeem_response_body import ClientRedemptionsRedeemResponseBody +from voucherify.models.client_validations_validate_request_body import ClientValidationsValidateRequestBody +from voucherify.models.client_validations_validate_request_body_options import ClientValidationsValidateRequestBodyOptions +from voucherify.models.client_validations_validate_request_body_redeemables_item import ClientValidationsValidateRequestBodyRedeemablesItem +from voucherify.models.client_validations_validate_request_body_redeemables_item_gift import ClientValidationsValidateRequestBodyRedeemablesItemGift +from voucherify.models.client_validations_validate_request_body_redeemables_item_reward import ClientValidationsValidateRequestBodyRedeemablesItemReward +from voucherify.models.client_validations_validate_response_body import ClientValidationsValidateResponseBody +from voucherify.models.client_validations_validate_response_body_redeemables_item import ClientValidationsValidateResponseBodyRedeemablesItem +from voucherify.models.client_validations_validate_response_body_redeemables_item_result import ClientValidationsValidateResponseBodyRedeemablesItemResult +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_details import ClientValidationsValidateResponseBodyRedeemablesItemResultDetails +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_discount import ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_discount_product import ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_gift import ClientValidationsValidateResponseBodyRedeemablesItemResultGift +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_loyalty_card import ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard +from voucherify.models.code_config import CodeConfig +from voucherify.models.create_publication_campaign import CreatePublicationCampaign +from voucherify.models.customer import Customer +from voucherify.models.customer_activity import CustomerActivity +from voucherify.models.customer_address import CustomerAddress +from voucherify.models.customer_id import CustomerId +from voucherify.models.customer_loyalty import CustomerLoyalty +from voucherify.models.customer_redeemable import CustomerRedeemable +from voucherify.models.customer_redeemable_redeemable import CustomerRedeemableRedeemable +from voucherify.models.customer_referrals import CustomerReferrals +from voucherify.models.customer_referrals_campaigns_item import CustomerReferralsCampaignsItem +from voucherify.models.customer_summary import CustomerSummary +from voucherify.models.customer_summary_orders import CustomerSummaryOrders +from voucherify.models.customer_summary_redemptions import CustomerSummaryRedemptions +from voucherify.models.customer_summary_redemptions_gift import CustomerSummaryRedemptionsGift +from voucherify.models.customer_summary_redemptions_loyalty_card import CustomerSummaryRedemptionsLoyaltyCard +from voucherify.models.customer_with_summary_loyalty_referrals import CustomerWithSummaryLoyaltyReferrals +from voucherify.models.customer_with_summary_loyalty_referrals_address import CustomerWithSummaryLoyaltyReferralsAddress +from voucherify.models.customer_with_summary_loyalty_referrals_assets import CustomerWithSummaryLoyaltyReferralsAssets +from voucherify.models.customers_activity_list_response_body import CustomersActivityListResponseBody +from voucherify.models.customers_create_request_body import CustomersCreateRequestBody +from voucherify.models.customers_create_request_body_address import CustomersCreateRequestBodyAddress +from voucherify.models.customers_create_response_body import CustomersCreateResponseBody +from voucherify.models.customers_create_response_body_address import CustomersCreateResponseBodyAddress +from voucherify.models.customers_create_response_body_assets import CustomersCreateResponseBodyAssets +from voucherify.models.customers_get_response_body import CustomersGetResponseBody +from voucherify.models.customers_get_response_body_address import CustomersGetResponseBodyAddress +from voucherify.models.customers_get_response_body_assets import CustomersGetResponseBodyAssets +from voucherify.models.customers_import_csv_create_response_body import CustomersImportCsvCreateResponseBody +from voucherify.models.customers_list_response_body import CustomersListResponseBody +from voucherify.models.customers_metadata_update_in_bulk_request_body import CustomersMetadataUpdateInBulkRequestBody +from voucherify.models.customers_metadata_update_in_bulk_response_body import CustomersMetadataUpdateInBulkResponseBody +from voucherify.models.customers_permanent_deletion_create_response_body import CustomersPermanentDeletionCreateResponseBody +from voucherify.models.customers_permanent_deletion_create_response_body_data_json import CustomersPermanentDeletionCreateResponseBodyDataJson +from voucherify.models.customers_redeemables_list_response_body import CustomersRedeemablesListResponseBody +from voucherify.models.customers_segments_list_response_body import CustomersSegmentsListResponseBody +from voucherify.models.customers_update_in_bulk_request_body import CustomersUpdateInBulkRequestBody +from voucherify.models.customers_update_in_bulk_request_body_address import CustomersUpdateInBulkRequestBodyAddress +from voucherify.models.customers_update_in_bulk_response_body import CustomersUpdateInBulkResponseBody +from voucherify.models.customers_update_request_body import CustomersUpdateRequestBody +from voucherify.models.customers_update_request_body_address import CustomersUpdateRequestBodyAddress +from voucherify.models.customers_update_response_body import CustomersUpdateResponseBody +from voucherify.models.customers_update_response_body_address import CustomersUpdateResponseBodyAddress +from voucherify.models.customers_update_response_body_assets import CustomersUpdateResponseBodyAssets +from voucherify.models.discount import Discount +from voucherify.models.discount_unit_multiple_one_unit import DiscountUnitMultipleOneUnit +from voucherify.models.earning_rule import EarningRule +from voucherify.models.earning_rule_custom_event import EarningRuleCustomEvent +from voucherify.models.earning_rule_loyalty import EarningRuleLoyalty +from voucherify.models.earning_rule_loyalty_custom_event import EarningRuleLoyaltyCustomEvent +from voucherify.models.earning_rule_loyalty_custom_event_metadata import EarningRuleLoyaltyCustomEventMetadata +from voucherify.models.earning_rule_loyalty_customer import EarningRuleLoyaltyCustomer +from voucherify.models.earning_rule_loyalty_customer_metadata import EarningRuleLoyaltyCustomerMetadata +from voucherify.models.earning_rule_loyalty_order import EarningRuleLoyaltyOrder +from voucherify.models.earning_rule_loyalty_order_amount import EarningRuleLoyaltyOrderAmount +from voucherify.models.earning_rule_loyalty_order_items import EarningRuleLoyaltyOrderItems +from voucherify.models.earning_rule_loyalty_order_items_amount import EarningRuleLoyaltyOrderItemsAmount +from voucherify.models.earning_rule_loyalty_order_items_quantity import EarningRuleLoyaltyOrderItemsQuantity +from voucherify.models.earning_rule_loyalty_order_items_subtotal_amount import EarningRuleLoyaltyOrderItemsSubtotalAmount +from voucherify.models.earning_rule_loyalty_order_metadata import EarningRuleLoyaltyOrderMetadata +from voucherify.models.earning_rule_loyalty_order_total_amount import EarningRuleLoyaltyOrderTotalAmount +from voucherify.models.earning_rule_loyalty_tier import EarningRuleLoyaltyTier +from voucherify.models.earning_rule_segment import EarningRuleSegment +from voucherify.models.earning_rule_source import EarningRuleSource +from voucherify.models.error import Error +from voucherify.models.events_create_request_body import EventsCreateRequestBody +from voucherify.models.events_create_request_body_loyalty import EventsCreateRequestBodyLoyalty +from voucherify.models.events_create_request_body_referral import EventsCreateRequestBodyReferral +from voucherify.models.events_create_response_body import EventsCreateResponseBody +from voucherify.models.export import Export +from voucherify.models.export_order_fields import ExportOrderFields +from voucherify.models.export_order_order import ExportOrderOrder +from voucherify.models.export_parameters import ExportParameters +from voucherify.models.export_parameters_filters import ExportParametersFilters +from voucherify.models.export_result import ExportResult +from voucherify.models.export_voucher_transactions_fields import ExportVoucherTransactionsFields +from voucherify.models.export_voucher_transactions_filters import ExportVoucherTransactionsFilters +from voucherify.models.export_voucher_transactions_order import ExportVoucherTransactionsOrder +from voucherify.models.exports_create_request_body import ExportsCreateRequestBody +from voucherify.models.exports_create_request_body_parameters import ExportsCreateRequestBodyParameters +from voucherify.models.exports_create_request_body_parameters_filters import ExportsCreateRequestBodyParametersFilters +from voucherify.models.exports_create_response_body import ExportsCreateResponseBody +from voucherify.models.exports_create_response_body_parameters import ExportsCreateResponseBodyParameters +from voucherify.models.exports_create_response_body_parameters_filters import ExportsCreateResponseBodyParametersFilters +from voucherify.models.exports_get_response_body import ExportsGetResponseBody +from voucherify.models.exports_get_response_body_parameters import ExportsGetResponseBodyParameters +from voucherify.models.exports_get_response_body_parameters_filters import ExportsGetResponseBodyParametersFilters +from voucherify.models.exports_get_response_body_result import ExportsGetResponseBodyResult +from voucherify.models.exports_list_response_body import ExportsListResponseBody +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.filters_condition import FiltersCondition +from voucherify.models.gift import Gift +from voucherify.models.inapplicable_to import InapplicableTo +from voucherify.models.inapplicable_to_result_list import InapplicableToResultList +from voucherify.models.junction import Junction +from voucherify.models.list_publications_item_voucher import ListPublicationsItemVoucher +from voucherify.models.loyalties_create_campaign_request_body import LoyaltiesCreateCampaignRequestBody +from voucherify.models.loyalties_create_campaign_response_body import LoyaltiesCreateCampaignResponseBody +from voucherify.models.loyalties_delete_response_body import LoyaltiesDeleteResponseBody +from voucherify.models.loyalties_earning_rules_create_request_body_item import LoyaltiesEarningRulesCreateRequestBodyItem +from voucherify.models.loyalties_earning_rules_create_request_body_item_custom_event import LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty import LoyaltiesEarningRulesCreateRequestBodyItemLoyalty +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_custom_event import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_customer import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_tier import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier +from voucherify.models.loyalties_earning_rules_create_request_body_item_segment import LoyaltiesEarningRulesCreateRequestBodyItemSegment +from voucherify.models.loyalties_earning_rules_create_request_body_item_source import LoyaltiesEarningRulesCreateRequestBodyItemSource +from voucherify.models.loyalties_earning_rules_create_response_body import LoyaltiesEarningRulesCreateResponseBody +from voucherify.models.loyalties_earning_rules_create_response_body_custom_event import LoyaltiesEarningRulesCreateResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty import LoyaltiesEarningRulesCreateResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_custom_event import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_customer import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_tier import LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_create_response_body_segment import LoyaltiesEarningRulesCreateResponseBodySegment +from voucherify.models.loyalties_earning_rules_create_response_body_source import LoyaltiesEarningRulesCreateResponseBodySource +from voucherify.models.loyalties_earning_rules_disable_response_body import LoyaltiesEarningRulesDisableResponseBody +from voucherify.models.loyalties_earning_rules_disable_response_body_custom_event import LoyaltiesEarningRulesDisableResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty import LoyaltiesEarningRulesDisableResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_custom_event import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_customer import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_tier import LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_disable_response_body_segment import LoyaltiesEarningRulesDisableResponseBodySegment +from voucherify.models.loyalties_earning_rules_disable_response_body_source import LoyaltiesEarningRulesDisableResponseBodySource +from voucherify.models.loyalties_earning_rules_enable_response_body import LoyaltiesEarningRulesEnableResponseBody +from voucherify.models.loyalties_earning_rules_enable_response_body_custom_event import LoyaltiesEarningRulesEnableResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty import LoyaltiesEarningRulesEnableResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_custom_event import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_customer import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_tier import LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_enable_response_body_segment import LoyaltiesEarningRulesEnableResponseBodySegment +from voucherify.models.loyalties_earning_rules_enable_response_body_source import LoyaltiesEarningRulesEnableResponseBodySource +from voucherify.models.loyalties_earning_rules_get_response_body import LoyaltiesEarningRulesGetResponseBody +from voucherify.models.loyalties_earning_rules_get_response_body_custom_event import LoyaltiesEarningRulesGetResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty import LoyaltiesEarningRulesGetResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_custom_event import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_customer import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_tier import LoyaltiesEarningRulesGetResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_get_response_body_segment import LoyaltiesEarningRulesGetResponseBodySegment +from voucherify.models.loyalties_earning_rules_get_response_body_source import LoyaltiesEarningRulesGetResponseBodySource +from voucherify.models.loyalties_earning_rules_list_response_body import LoyaltiesEarningRulesListResponseBody +from voucherify.models.loyalties_earning_rules_update_request_body import LoyaltiesEarningRulesUpdateRequestBody +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty import LoyaltiesEarningRulesUpdateRequestBodyLoyalty +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_custom_event import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_customer import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_customer_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_quantity import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_total_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_update_request_body_source import LoyaltiesEarningRulesUpdateRequestBodySource +from voucherify.models.loyalties_earning_rules_update_response_body import LoyaltiesEarningRulesUpdateResponseBody +from voucherify.models.loyalties_earning_rules_update_response_body_custom_event import LoyaltiesEarningRulesUpdateResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty import LoyaltiesEarningRulesUpdateResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_custom_event import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_customer import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_tier import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_update_response_body_segment import LoyaltiesEarningRulesUpdateResponseBodySegment +from voucherify.models.loyalties_earning_rules_update_response_body_source import LoyaltiesEarningRulesUpdateResponseBodySource +from voucherify.models.loyalties_get_campaign_response_body import LoyaltiesGetCampaignResponseBody +from voucherify.models.loyalties_list_campaigns_response_body import LoyaltiesListCampaignsResponseBody +from voucherify.models.loyalties_list_members_response_body import LoyaltiesListMembersResponseBody +from voucherify.models.loyalties_loyalty_tier_reward import LoyaltiesLoyaltyTierReward +from voucherify.models.loyalties_member_activity_list_response_body import LoyaltiesMemberActivityListResponseBody +from voucherify.models.loyalties_members_balance_update_request_body import LoyaltiesMembersBalanceUpdateRequestBody +from voucherify.models.loyalties_members_balance_update_response_body import LoyaltiesMembersBalanceUpdateResponseBody +from voucherify.models.loyalties_members_balance_update_response_body_related_object import LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject +from voucherify.models.loyalties_members_create_request_body import LoyaltiesMembersCreateRequestBody +from voucherify.models.loyalties_members_create_response_body import LoyaltiesMembersCreateResponseBody +from voucherify.models.loyalties_members_create_response_body_loyalty_card import LoyaltiesMembersCreateResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_create_response_body_publish import LoyaltiesMembersCreateResponseBodyPublish +from voucherify.models.loyalties_members_create_response_body_redemption import LoyaltiesMembersCreateResponseBodyRedemption +from voucherify.models.loyalties_members_get_response_body import LoyaltiesMembersGetResponseBody +from voucherify.models.loyalties_members_get_response_body_loyalty_card import LoyaltiesMembersGetResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_get_response_body_publish import LoyaltiesMembersGetResponseBodyPublish +from voucherify.models.loyalties_members_get_response_body_redemption import LoyaltiesMembersGetResponseBodyRedemption +from voucherify.models.loyalties_members_points_expiration_list_response_body import LoyaltiesMembersPointsExpirationListResponseBody +from voucherify.models.loyalties_members_points_expiration_list_response_body_data_item import LoyaltiesMembersPointsExpirationListResponseBodyDataItem +from voucherify.models.loyalties_members_points_expiration_list_response_body_data_item_bucket import LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket +from voucherify.models.loyalties_members_redemption_redeem_request_body import LoyaltiesMembersRedemptionRedeemRequestBody +from voucherify.models.loyalties_members_redemption_redeem_request_body_reward import LoyaltiesMembersRedemptionRedeemRequestBodyReward +from voucherify.models.loyalties_members_redemption_redeem_response_body import LoyaltiesMembersRedemptionRedeemResponseBody +from voucherify.models.loyalties_members_redemption_redeem_response_body_channel import LoyaltiesMembersRedemptionRedeemResponseBodyChannel +from voucherify.models.loyalties_members_redemption_redeem_response_body_gift import LoyaltiesMembersRedemptionRedeemResponseBodyGift +from voucherify.models.loyalties_members_redemption_redeem_response_body_loyalty_card import LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher import LoyaltiesMembersRedemptionRedeemResponseBodyVoucher +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_gift import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_loyalty_card import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_publish import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_redemption import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption +from voucherify.models.loyalties_members_rewards_list_response_body import LoyaltiesMembersRewardsListResponseBody +from voucherify.models.loyalties_members_rewards_list_response_body_data_item import LoyaltiesMembersRewardsListResponseBodyDataItem +from voucherify.models.loyalties_members_tiers_list_response_body import LoyaltiesMembersTiersListResponseBody +from voucherify.models.loyalties_members_transactions_export_create_request_body import LoyaltiesMembersTransactionsExportCreateRequestBody +from voucherify.models.loyalties_members_transactions_export_create_request_body_parameters import LoyaltiesMembersTransactionsExportCreateRequestBodyParameters +from voucherify.models.loyalties_members_transactions_export_create_response_body import LoyaltiesMembersTransactionsExportCreateResponseBody +from voucherify.models.loyalties_members_transactions_export_create_response_body_parameters import LoyaltiesMembersTransactionsExportCreateResponseBodyParameters +from voucherify.models.loyalties_members_transactions_list_response_body import LoyaltiesMembersTransactionsListResponseBody +from voucherify.models.loyalties_members_transfers_create_response_body import LoyaltiesMembersTransfersCreateResponseBody +from voucherify.models.loyalties_members_transfers_create_response_body_assets import LoyaltiesMembersTransfersCreateResponseBodyAssets +from voucherify.models.loyalties_members_transfers_create_response_body_assets_barcode import LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode +from voucherify.models.loyalties_members_transfers_create_response_body_assets_qr import LoyaltiesMembersTransfersCreateResponseBodyAssetsQr +from voucherify.models.loyalties_members_transfers_create_response_body_loyalty_card import LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_transfers_create_response_body_publish import LoyaltiesMembersTransfersCreateResponseBodyPublish +from voucherify.models.loyalties_members_transfers_create_response_body_redemption import LoyaltiesMembersTransfersCreateResponseBodyRedemption +from voucherify.models.loyalties_points_expiration_export_create_request_body import LoyaltiesPointsExpirationExportCreateRequestBody +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters import LoyaltiesPointsExpirationExportCreateRequestBodyParameters +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions +from voucherify.models.loyalties_points_expiration_export_create_response_body import LoyaltiesPointsExpirationExportCreateResponseBody +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters import LoyaltiesPointsExpirationExportCreateResponseBodyParameters +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions +from voucherify.models.loyalties_reward_assignments_get_response_body import LoyaltiesRewardAssignmentsGetResponseBody +from voucherify.models.loyalties_reward_assignments_get_response_body_parameters import LoyaltiesRewardAssignmentsGetResponseBodyParameters +from voucherify.models.loyalties_reward_assignments_get_response_body_parameters_loyalty import LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty +from voucherify.models.loyalties_reward_assignments_list_response_body import LoyaltiesRewardAssignmentsListResponseBody +from voucherify.models.loyalties_reward_assignments_reward_get_response_body import LoyaltiesRewardAssignmentsRewardGetResponseBody +from voucherify.models.loyalties_reward_assignments_reward_get_response_body_attributes import LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes +from voucherify.models.loyalties_rewards_create_assignment_item_request_body import LoyaltiesRewardsCreateAssignmentItemRequestBody +from voucherify.models.loyalties_rewards_create_assignment_item_request_body_parameters import LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters +from voucherify.models.loyalties_rewards_create_assignment_item_request_body_parameters_loyalty import LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty +from voucherify.models.loyalties_rewards_create_assignment_response_body import LoyaltiesRewardsCreateAssignmentResponseBody +from voucherify.models.loyalties_rewards_create_assignment_response_body_parameters import LoyaltiesRewardsCreateAssignmentResponseBodyParameters +from voucherify.models.loyalties_rewards_create_assignment_response_body_parameters_loyalty import LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty +from voucherify.models.loyalties_rewards_get_response_body import LoyaltiesRewardsGetResponseBody +from voucherify.models.loyalties_rewards_get_response_body_parameters import LoyaltiesRewardsGetResponseBodyParameters +from voucherify.models.loyalties_rewards_get_response_body_parameters_loyalty import LoyaltiesRewardsGetResponseBodyParametersLoyalty +from voucherify.models.loyalties_rewards_list_assignments_response_body import LoyaltiesRewardsListAssignmentsResponseBody +from voucherify.models.loyalties_rewards_update_assignment_request_body import LoyaltiesRewardsUpdateAssignmentRequestBody +from voucherify.models.loyalties_rewards_update_assignment_request_body_parameters import LoyaltiesRewardsUpdateAssignmentRequestBodyParameters +from voucherify.models.loyalties_rewards_update_assignment_request_body_parameters_loyalty import LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty +from voucherify.models.loyalties_rewards_update_assignment_response_body import LoyaltiesRewardsUpdateAssignmentResponseBody +from voucherify.models.loyalties_rewards_update_assignment_response_body_parameters import LoyaltiesRewardsUpdateAssignmentResponseBodyParameters +from voucherify.models.loyalties_rewards_update_assignment_response_body_parameters_loyalty import LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty +from voucherify.models.loyalties_tiers_create_in_bulk_request_body_item import LoyaltiesTiersCreateInBulkRequestBodyItem +from voucherify.models.loyalties_tiers_earning_rules_list_response_body import LoyaltiesTiersEarningRulesListResponseBody +from voucherify.models.loyalties_tiers_get_response_body import LoyaltiesTiersGetResponseBody +from voucherify.models.loyalties_tiers_get_response_body_config import LoyaltiesTiersGetResponseBodyConfig +from voucherify.models.loyalties_tiers_get_response_body_config_points import LoyaltiesTiersGetResponseBodyConfigPoints +from voucherify.models.loyalties_tiers_get_response_body_points import LoyaltiesTiersGetResponseBodyPoints +from voucherify.models.loyalties_tiers_list_response_body import LoyaltiesTiersListResponseBody +from voucherify.models.loyalties_tiers_rewards_list_response_body import LoyaltiesTiersRewardsListResponseBody +from voucherify.models.loyalties_transfer_points import LoyaltiesTransferPoints +from voucherify.models.loyalties_update_campaign_request_body import LoyaltiesUpdateCampaignRequestBody +from voucherify.models.loyalties_update_campaign_request_body_options import LoyaltiesUpdateCampaignRequestBodyOptions +from voucherify.models.loyalties_update_campaign_response_body import LoyaltiesUpdateCampaignResponseBody +from voucherify.models.loyalty_campaign import LoyaltyCampaign +from voucherify.models.loyalty_campaign_voucher import LoyaltyCampaignVoucher +from voucherify.models.loyalty_campaign_voucher_redemption import LoyaltyCampaignVoucherRedemption +from voucherify.models.loyalty_card_transaction import LoyaltyCardTransaction +from voucherify.models.loyalty_card_transaction_details import LoyaltyCardTransactionDetails +from voucherify.models.loyalty_card_transaction_details_balance import LoyaltyCardTransactionDetailsBalance +from voucherify.models.loyalty_card_transaction_details_balance_related_object import LoyaltyCardTransactionDetailsBalanceRelatedObject +from voucherify.models.loyalty_card_transaction_details_custom_event import LoyaltyCardTransactionDetailsCustomEvent +from voucherify.models.loyalty_card_transaction_details_earning_rule import LoyaltyCardTransactionDetailsEarningRule +from voucherify.models.loyalty_card_transaction_details_earning_rule_source import LoyaltyCardTransactionDetailsEarningRuleSource +from voucherify.models.loyalty_card_transaction_details_event import LoyaltyCardTransactionDetailsEvent +from voucherify.models.loyalty_card_transaction_details_event_schema import LoyaltyCardTransactionDetailsEventSchema +from voucherify.models.loyalty_card_transaction_details_loyalty_tier import LoyaltyCardTransactionDetailsLoyaltyTier +from voucherify.models.loyalty_card_transaction_details_order import LoyaltyCardTransactionDetailsOrder +from voucherify.models.loyalty_card_transaction_details_redemption import LoyaltyCardTransactionDetailsRedemption +from voucherify.models.loyalty_card_transaction_details_reward import LoyaltyCardTransactionDetailsReward +from voucherify.models.loyalty_card_transaction_details_rollback import LoyaltyCardTransactionDetailsRollback +from voucherify.models.loyalty_card_transaction_details_segment import LoyaltyCardTransactionDetailsSegment +from voucherify.models.loyalty_card_transactions_type import LoyaltyCardTransactionsType +from voucherify.models.loyalty_member import LoyaltyMember +from voucherify.models.loyalty_member_loyalty_card import LoyaltyMemberLoyaltyCard +from voucherify.models.loyalty_member_publish import LoyaltyMemberPublish +from voucherify.models.loyalty_member_redemption import LoyaltyMemberRedemption +from voucherify.models.loyalty_tier import LoyaltyTier +from voucherify.models.loyalty_tier_base import LoyaltyTierBase +from voucherify.models.loyalty_tier_base_points import LoyaltyTierBasePoints +from voucherify.models.loyalty_tier_config import LoyaltyTierConfig +from voucherify.models.loyalty_tier_config_points import LoyaltyTierConfigPoints +from voucherify.models.loyalty_tier_expiration import LoyaltyTierExpiration +from voucherify.models.loyalty_tier_points import LoyaltyTierPoints +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.loyalty_tiers_expiration_all_expiration_date import LoyaltyTiersExpirationAllExpirationDate +from voucherify.models.loyalty_tiers_expiration_all_expiration_date_rounding import LoyaltyTiersExpirationAllExpirationDateRounding +from voucherify.models.loyalty_tiers_expiration_all_start_date import LoyaltyTiersExpirationAllStartDate +from voucherify.models.lucky_draw import LuckyDraw +from voucherify.models.member_activity import MemberActivity +from voucherify.models.order import Order +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.order_calculated_item_product import OrderCalculatedItemProduct +from voucherify.models.order_calculated_item_sku import OrderCalculatedItemSku +from voucherify.models.order_item import OrderItem +from voucherify.models.order_item_product import OrderItemProduct +from voucherify.models.order_item_sku import OrderItemSku +from voucherify.models.orders_create_request_body import OrdersCreateRequestBody +from voucherify.models.orders_create_response_body import OrdersCreateResponseBody +from voucherify.models.orders_export_create_request_body import OrdersExportCreateRequestBody +from voucherify.models.orders_export_create_request_body_parameters import OrdersExportCreateRequestBodyParameters +from voucherify.models.orders_export_create_response_body import OrdersExportCreateResponseBody +from voucherify.models.orders_export_create_response_body_parameters import OrdersExportCreateResponseBodyParameters +from voucherify.models.orders_get_response_body import OrdersGetResponseBody +from voucherify.models.orders_import_create_request_body_item import OrdersImportCreateRequestBodyItem +from voucherify.models.orders_import_create_response_body import OrdersImportCreateResponseBody +from voucherify.models.orders_list_response_body import OrdersListResponseBody +from voucherify.models.orders_update_request_body import OrdersUpdateRequestBody +from voucherify.models.orders_update_response_body import OrdersUpdateResponseBody +from voucherify.models.parameter_activity_category import ParameterActivityCategory +from voucherify.models.parameter_campaign_type import ParameterCampaignType +from voucherify.models.parameter_created_before_after import ParameterCreatedBeforeAfter +from voucherify.models.parameter_expand_list_campaigns import ParameterExpandListCampaigns +from voucherify.models.parameter_filters_list_customer_redeemables import ParameterFiltersListCustomerRedeemables +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_id import ParameterFiltersListCustomerRedeemablesCampaignId +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_type import ParameterFiltersListCustomerRedeemablesCampaignType +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_type_conditions import ParameterFiltersListCustomerRedeemablesCampaignTypeConditions +from voucherify.models.parameter_filters_list_customer_redeemables_created_at import ParameterFiltersListCustomerRedeemablesCreatedAt +from voucherify.models.parameter_filters_list_customer_redeemables_created_at_conditions import ParameterFiltersListCustomerRedeemablesCreatedAtConditions +from voucherify.models.parameter_filters_list_customer_redeemables_holder_role import ParameterFiltersListCustomerRedeemablesHolderRole +from voucherify.models.parameter_filters_list_customer_redeemables_holder_role_conditions import ParameterFiltersListCustomerRedeemablesHolderRoleConditions +from voucherify.models.parameter_filters_list_customer_redeemables_id import ParameterFiltersListCustomerRedeemablesId +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_id import ParameterFiltersListCustomerRedeemablesRedeemableId +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_object import ParameterFiltersListCustomerRedeemablesRedeemableObject +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_object_conditions import ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions +from voucherify.models.parameter_filters_list_customer_redeemables_voucher_type import ParameterFiltersListCustomerRedeemablesVoucherType +from voucherify.models.parameter_filters_list_customer_redeemables_voucher_type_conditions import ParameterFiltersListCustomerRedeemablesVoucherTypeConditions +from voucherify.models.parameter_filters_list_redemptions import ParameterFiltersListRedemptions +from voucherify.models.parameter_filters_list_redemptions_campaign_name import ParameterFiltersListRedemptionsCampaignName +from voucherify.models.parameter_filters_list_redemptions_customer_id import ParameterFiltersListRedemptionsCustomerId +from voucherify.models.parameter_filters_list_redemptions_failure_code import ParameterFiltersListRedemptionsFailureCode +from voucherify.models.parameter_filters_list_redemptions_object import ParameterFiltersListRedemptionsObject +from voucherify.models.parameter_filters_list_redemptions_parent_redemption_id import ParameterFiltersListRedemptionsParentRedemptionId +from voucherify.models.parameter_filters_list_redemptions_related_object_id import ParameterFiltersListRedemptionsRelatedObjectId +from voucherify.models.parameter_filters_list_redemptions_related_object_parent_id import ParameterFiltersListRedemptionsRelatedObjectParentId +from voucherify.models.parameter_filters_list_redemptions_result import ParameterFiltersListRedemptionsResult +from voucherify.models.parameter_filters_list_redemptions_user_login import ParameterFiltersListRedemptionsUserLogin +from voucherify.models.parameter_filters_list_redemptions_voucher_code import ParameterFiltersListRedemptionsVoucherCode +from voucherify.models.parameter_order import ParameterOrder +from voucherify.models.parameter_order_created_at import ParameterOrderCreatedAt +from voucherify.models.parameter_order_list_all_promotion_stacks import ParameterOrderListAllPromotionStacks +from voucherify.models.parameter_order_list_campaigns import ParameterOrderListCampaigns +from voucherify.models.parameter_order_list_customers import ParameterOrderListCustomers +from voucherify.models.parameter_order_list_earning_rules import ParameterOrderListEarningRules +from voucherify.models.parameter_order_list_exports import ParameterOrderListExports +from voucherify.models.parameter_order_list_loyalty_tiers import ParameterOrderListLoyaltyTiers +from voucherify.models.parameter_order_list_orders import ParameterOrderListOrders +from voucherify.models.parameter_order_list_promotion_tiers import ParameterOrderListPromotionTiers +from voucherify.models.parameter_order_list_promotion_tiers_client_side import ParameterOrderListPromotionTiersClientSide +from voucherify.models.parameter_order_list_publications import ParameterOrderListPublications +from voucherify.models.parameter_order_list_redeemables import ParameterOrderListRedeemables +from voucherify.models.parameter_order_list_redemptions import ParameterOrderListRedemptions +from voucherify.models.parameter_order_list_transactions import ParameterOrderListTransactions +from voucherify.models.parameter_order_list_validation_rule_assignments import ParameterOrderListValidationRuleAssignments +from voucherify.models.parameter_order_list_validation_rules import ParameterOrderListValidationRules +from voucherify.models.parameter_order_vouchers import ParameterOrderVouchers +from voucherify.models.parameter_result_list_publications import ParameterResultListPublications +from voucherify.models.parameter_updated_before_after import ParameterUpdatedBeforeAfter +from voucherify.models.parameter_voucher_type_list_publications import ParameterVoucherTypeListPublications +from voucherify.models.points_expiration_types import PointsExpirationTypes +from voucherify.models.product import Product +from voucherify.models.product_collections_create_request_body import ProductCollectionsCreateRequestBody +from voucherify.models.product_collections_create_request_body_filter import ProductCollectionsCreateRequestBodyFilter +from voucherify.models.product_collections_create_request_body_products_item import ProductCollectionsCreateRequestBodyProductsItem +from voucherify.models.product_collections_create_response_body import ProductCollectionsCreateResponseBody +from voucherify.models.product_collections_create_response_body_filter import ProductCollectionsCreateResponseBodyFilter +from voucherify.models.product_collections_create_response_body_products_item import ProductCollectionsCreateResponseBodyProductsItem +from voucherify.models.product_collections_get_response_body import ProductCollectionsGetResponseBody +from voucherify.models.product_collections_get_response_body_filter import ProductCollectionsGetResponseBodyFilter +from voucherify.models.product_collections_get_response_body_products_item import ProductCollectionsGetResponseBodyProductsItem +from voucherify.models.product_collections_item import ProductCollectionsItem +from voucherify.models.product_collections_item_filter import ProductCollectionsItemFilter +from voucherify.models.product_collections_item_products_item import ProductCollectionsItemProductsItem +from voucherify.models.product_collections_list_response_body import ProductCollectionsListResponseBody +from voucherify.models.product_collections_products_list_response_body import ProductCollectionsProductsListResponseBody +from voucherify.models.product_collections_products_list_response_body_data_item import ProductCollectionsProductsListResponseBodyDataItem +from voucherify.models.product_without_skus import ProductWithoutSkus +from voucherify.models.products_create_request_body import ProductsCreateRequestBody +from voucherify.models.products_create_response_body import ProductsCreateResponseBody +from voucherify.models.products_get_response_body import ProductsGetResponseBody +from voucherify.models.products_import_csv_create_response_body import ProductsImportCsvCreateResponseBody +from voucherify.models.products_list_response_body import ProductsListResponseBody +from voucherify.models.products_metadata_update_in_bulk_request_body import ProductsMetadataUpdateInBulkRequestBody +from voucherify.models.products_metadata_update_in_bulk_response_body import ProductsMetadataUpdateInBulkResponseBody +from voucherify.models.products_skus_create_request_body import ProductsSkusCreateRequestBody +from voucherify.models.products_skus_create_response_body import ProductsSkusCreateResponseBody +from voucherify.models.products_skus_list_response_body import ProductsSkusListResponseBody +from voucherify.models.products_skus_update_request_body import ProductsSkusUpdateRequestBody +from voucherify.models.products_skus_update_response_body import ProductsSkusUpdateResponseBody +from voucherify.models.products_update_in_bulk_request_body import ProductsUpdateInBulkRequestBody +from voucherify.models.products_update_in_bulk_response_body import ProductsUpdateInBulkResponseBody +from voucherify.models.products_update_request_body import ProductsUpdateRequestBody +from voucherify.models.products_update_response_body import ProductsUpdateResponseBody +from voucherify.models.promotion_stack import PromotionStack +from voucherify.models.promotion_stack_base import PromotionStackBase +from voucherify.models.promotion_stack_base_tiers import PromotionStackBaseTiers +from voucherify.models.promotion_stack_tiers import PromotionStackTiers +from voucherify.models.promotion_tier import PromotionTier +from voucherify.models.promotion_tier_action import PromotionTierAction +from voucherify.models.promotion_tier_campaign import PromotionTierCampaign +from voucherify.models.promotion_tier_create_params import PromotionTierCreateParams +from voucherify.models.promotion_tier_create_params_action import PromotionTierCreateParamsAction +from voucherify.models.promotion_tier_summary import PromotionTierSummary +from voucherify.models.promotion_tier_summary_orders import PromotionTierSummaryOrders +from voucherify.models.promotion_tier_summary_redemptions import PromotionTierSummaryRedemptions +from voucherify.models.promotion_tiers_list import PromotionTiersList +from voucherify.models.promotions_stacks_create_request_body import PromotionsStacksCreateRequestBody +from voucherify.models.promotions_stacks_create_request_body_tiers import PromotionsStacksCreateRequestBodyTiers +from voucherify.models.promotions_stacks_create_response_body import PromotionsStacksCreateResponseBody +from voucherify.models.promotions_stacks_create_response_body_tiers import PromotionsStacksCreateResponseBodyTiers +from voucherify.models.promotions_stacks_get_response_body import PromotionsStacksGetResponseBody +from voucherify.models.promotions_stacks_get_response_body_tiers import PromotionsStacksGetResponseBodyTiers +from voucherify.models.promotions_stacks_list_response_body import PromotionsStacksListResponseBody +from voucherify.models.promotions_stacks_update_request_body import PromotionsStacksUpdateRequestBody +from voucherify.models.promotions_stacks_update_request_body_tiers import PromotionsStacksUpdateRequestBodyTiers +from voucherify.models.promotions_stacks_update_response_body import PromotionsStacksUpdateResponseBody +from voucherify.models.promotions_stacks_update_response_body_tiers import PromotionsStacksUpdateResponseBodyTiers +from voucherify.models.promotions_tiers_create_request_body import PromotionsTiersCreateRequestBody +from voucherify.models.promotions_tiers_create_request_body_action import PromotionsTiersCreateRequestBodyAction +from voucherify.models.promotions_tiers_create_response_body import PromotionsTiersCreateResponseBody +from voucherify.models.promotions_tiers_create_response_body_action import PromotionsTiersCreateResponseBodyAction +from voucherify.models.promotions_tiers_create_response_body_campaign import PromotionsTiersCreateResponseBodyCampaign +from voucherify.models.promotions_tiers_create_response_body_summary import PromotionsTiersCreateResponseBodySummary +from voucherify.models.promotions_tiers_create_response_body_summary_orders import PromotionsTiersCreateResponseBodySummaryOrders +from voucherify.models.promotions_tiers_create_response_body_summary_redemptions import PromotionsTiersCreateResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_disable_response_body import PromotionsTiersDisableResponseBody +from voucherify.models.promotions_tiers_disable_response_body_action import PromotionsTiersDisableResponseBodyAction +from voucherify.models.promotions_tiers_disable_response_body_campaign import PromotionsTiersDisableResponseBodyCampaign +from voucherify.models.promotions_tiers_disable_response_body_summary import PromotionsTiersDisableResponseBodySummary +from voucherify.models.promotions_tiers_disable_response_body_summary_orders import PromotionsTiersDisableResponseBodySummaryOrders +from voucherify.models.promotions_tiers_disable_response_body_summary_redemptions import PromotionsTiersDisableResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_enable_response_body import PromotionsTiersEnableResponseBody +from voucherify.models.promotions_tiers_enable_response_body_action import PromotionsTiersEnableResponseBodyAction +from voucherify.models.promotions_tiers_enable_response_body_campaign import PromotionsTiersEnableResponseBodyCampaign +from voucherify.models.promotions_tiers_enable_response_body_summary import PromotionsTiersEnableResponseBodySummary +from voucherify.models.promotions_tiers_enable_response_body_summary_orders import PromotionsTiersEnableResponseBodySummaryOrders +from voucherify.models.promotions_tiers_enable_response_body_summary_redemptions import PromotionsTiersEnableResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_get_response_body import PromotionsTiersGetResponseBody +from voucherify.models.promotions_tiers_get_response_body_action import PromotionsTiersGetResponseBodyAction +from voucherify.models.promotions_tiers_get_response_body_campaign import PromotionsTiersGetResponseBodyCampaign +from voucherify.models.promotions_tiers_get_response_body_summary import PromotionsTiersGetResponseBodySummary +from voucherify.models.promotions_tiers_get_response_body_summary_orders import PromotionsTiersGetResponseBodySummaryOrders +from voucherify.models.promotions_tiers_get_response_body_summary_redemptions import PromotionsTiersGetResponseBodySummaryRedemptions +from voucherify.models.promotions_tiers_list_response_body import PromotionsTiersListResponseBody +from voucherify.models.promotions_tiers_update_request_body import PromotionsTiersUpdateRequestBody +from voucherify.models.promotions_tiers_update_request_body_action import PromotionsTiersUpdateRequestBodyAction +from voucherify.models.promotions_tiers_update_response_body import PromotionsTiersUpdateResponseBody +from voucherify.models.promotions_tiers_update_response_body_action import PromotionsTiersUpdateResponseBodyAction +from voucherify.models.promotions_tiers_update_response_body_campaign import PromotionsTiersUpdateResponseBodyCampaign +from voucherify.models.promotions_tiers_update_response_body_summary import PromotionsTiersUpdateResponseBodySummary +from voucherify.models.promotions_tiers_update_response_body_summary_orders import PromotionsTiersUpdateResponseBodySummaryOrders +from voucherify.models.promotions_tiers_update_response_body_summary_redemptions import PromotionsTiersUpdateResponseBodySummaryRedemptions +from voucherify.models.publications_create_request_body import PublicationsCreateRequestBody +from voucherify.models.publications_create_request_body_customer import PublicationsCreateRequestBodyCustomer +from voucherify.models.publications_create_request_body_customer_address import PublicationsCreateRequestBodyCustomerAddress +from voucherify.models.publications_create_response_body import PublicationsCreateResponseBody +from voucherify.models.publications_list_response_body import PublicationsListResponseBody +from voucherify.models.publications_list_response_body_publications_item import PublicationsListResponseBodyPublicationsItem +from voucherify.models.publications_list_response_body_publications_item_metadata import PublicationsListResponseBodyPublicationsItemMetadata +from voucherify.models.qualifications_check_eligibility_request_body import QualificationsCheckEligibilityRequestBody +from voucherify.models.qualifications_check_eligibility_response_body import QualificationsCheckEligibilityResponseBody +from voucherify.models.qualifications_field_conditions import QualificationsFieldConditions +from voucherify.models.qualifications_filters_condition import QualificationsFiltersCondition +from voucherify.models.qualifications_option import QualificationsOption +from voucherify.models.qualifications_option_filters import QualificationsOptionFilters +from voucherify.models.qualifications_option_filters_campaign_type import QualificationsOptionFiltersCampaignType +from voucherify.models.qualifications_option_filters_campaign_type_conditions import QualificationsOptionFiltersCampaignTypeConditions +from voucherify.models.qualifications_option_filters_holder_role import QualificationsOptionFiltersHolderRole +from voucherify.models.qualifications_option_filters_holder_role_conditions import QualificationsOptionFiltersHolderRoleConditions +from voucherify.models.qualifications_option_filters_resource_type import QualificationsOptionFiltersResourceType +from voucherify.models.qualifications_option_filters_resource_type_conditions import QualificationsOptionFiltersResourceTypeConditions +from voucherify.models.qualifications_redeemable import QualificationsRedeemable +from voucherify.models.qualifications_redeemable_base import QualificationsRedeemableBase +from voucherify.models.qualifications_redeemables import QualificationsRedeemables +from voucherify.models.redeemable_gift import RedeemableGift +from voucherify.models.redeemable_loyalty_card import RedeemableLoyaltyCard +from voucherify.models.redeemable_result import RedeemableResult +from voucherify.models.redeemable_voucher import RedeemableVoucher +from voucherify.models.redeemable_voucher_gift import RedeemableVoucherGift +from voucherify.models.redeemable_voucher_loyalty_card import RedeemableVoucherLoyaltyCard +from voucherify.models.redeemable_voucher_publish import RedeemableVoucherPublish +from voucherify.models.redeemable_voucher_redemption import RedeemableVoucherRedemption +from voucherify.models.redemption import Redemption +from voucherify.models.redemption_channel import RedemptionChannel +from voucherify.models.redemption_entry import RedemptionEntry +from voucherify.models.redemption_entry_channel import RedemptionEntryChannel +from voucherify.models.redemption_entry_customer import RedemptionEntryCustomer +from voucherify.models.redemption_entry_gift import RedemptionEntryGift +from voucherify.models.redemption_entry_loyalty_card import RedemptionEntryLoyaltyCard +from voucherify.models.redemption_entry_order import RedemptionEntryOrder +from voucherify.models.redemption_entry_order_customer import RedemptionEntryOrderCustomer +from voucherify.models.redemption_entry_order_referrer import RedemptionEntryOrderReferrer +from voucherify.models.redemption_entry_promotion_tier import RedemptionEntryPromotionTier +from voucherify.models.redemption_entry_promotion_tier_action import RedemptionEntryPromotionTierAction +from voucherify.models.redemption_entry_promotion_tier_campaign import RedemptionEntryPromotionTierCampaign +from voucherify.models.redemption_entry_promotion_tier_summary import RedemptionEntryPromotionTierSummary +from voucherify.models.redemption_entry_promotion_tier_summary_orders import RedemptionEntryPromotionTierSummaryOrders +from voucherify.models.redemption_entry_promotion_tier_summary_redemptions import RedemptionEntryPromotionTierSummaryRedemptions +from voucherify.models.redemption_entry_related_redemptions import RedemptionEntryRelatedRedemptions +from voucherify.models.redemption_entry_related_redemptions_redemptions_item import RedemptionEntryRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_entry_related_redemptions_rollbacks_item import RedemptionEntryRelatedRedemptionsRollbacksItem +from voucherify.models.redemption_entry_voucher import RedemptionEntryVoucher +from voucherify.models.redemption_entry_voucher_gift import RedemptionEntryVoucherGift +from voucherify.models.redemption_entry_voucher_loyalty_card import RedemptionEntryVoucherLoyaltyCard +from voucherify.models.redemption_entry_voucher_publish import RedemptionEntryVoucherPublish +from voucherify.models.redemption_entry_voucher_redemption import RedemptionEntryVoucherRedemption +from voucherify.models.redemption_gift import RedemptionGift +from voucherify.models.redemption_loyalty_card import RedemptionLoyaltyCard +from voucherify.models.redemption_related_redemptions import RedemptionRelatedRedemptions +from voucherify.models.redemption_related_redemptions_redemptions_item import RedemptionRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_related_redemptions_rollbacks_item import RedemptionRelatedRedemptionsRollbacksItem +from voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.redemption_reward_result_parameters import RedemptionRewardResultParameters +from voucherify.models.redemption_reward_result_parameters_campaign import RedemptionRewardResultParametersCampaign +from voucherify.models.redemption_reward_result_parameters_coin import RedemptionRewardResultParametersCoin +from voucherify.models.redemption_reward_result_parameters_product import RedemptionRewardResultParametersProduct +from voucherify.models.redemption_rollback import RedemptionRollback +from voucherify.models.redemption_rollback_channel import RedemptionRollbackChannel +from voucherify.models.redemption_rollback_gift import RedemptionRollbackGift +from voucherify.models.redemption_rollback_loyalty_card import RedemptionRollbackLoyaltyCard +from voucherify.models.redemption_rollback_related_redemptions import RedemptionRollbackRelatedRedemptions +from voucherify.models.redemption_rollback_related_redemptions_redemptions_item import RedemptionRollbackRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_rollback_related_redemptions_rollbacks_item import RedemptionRollbackRelatedRedemptionsRollbacksItem +from voucherify.models.redemption_voucher import RedemptionVoucher +from voucherify.models.redemption_voucher_gift import RedemptionVoucherGift +from voucherify.models.redemption_voucher_loyalty_card import RedemptionVoucherLoyaltyCard +from voucherify.models.redemption_voucher_publish import RedemptionVoucherPublish +from voucherify.models.redemption_voucher_redemption import RedemptionVoucherRedemption +from voucherify.models.redemptions_get_response_body import RedemptionsGetResponseBody +from voucherify.models.redemptions_get_response_body_channel import RedemptionsGetResponseBodyChannel +from voucherify.models.redemptions_get_response_body_customer import RedemptionsGetResponseBodyCustomer +from voucherify.models.redemptions_get_response_body_gift import RedemptionsGetResponseBodyGift +from voucherify.models.redemptions_get_response_body_loyalty_card import RedemptionsGetResponseBodyLoyaltyCard +from voucherify.models.redemptions_get_response_body_order import RedemptionsGetResponseBodyOrder +from voucherify.models.redemptions_get_response_body_order_customer import RedemptionsGetResponseBodyOrderCustomer +from voucherify.models.redemptions_get_response_body_order_referrer import RedemptionsGetResponseBodyOrderReferrer +from voucherify.models.redemptions_get_response_body_promotion_tier import RedemptionsGetResponseBodyPromotionTier +from voucherify.models.redemptions_get_response_body_promotion_tier_action import RedemptionsGetResponseBodyPromotionTierAction +from voucherify.models.redemptions_get_response_body_promotion_tier_campaign import RedemptionsGetResponseBodyPromotionTierCampaign +from voucherify.models.redemptions_get_response_body_promotion_tier_summary import RedemptionsGetResponseBodyPromotionTierSummary +from voucherify.models.redemptions_get_response_body_promotion_tier_summary_orders import RedemptionsGetResponseBodyPromotionTierSummaryOrders +from voucherify.models.redemptions_get_response_body_promotion_tier_summary_redemptions import RedemptionsGetResponseBodyPromotionTierSummaryRedemptions +from voucherify.models.redemptions_get_response_body_related_redemptions import RedemptionsGetResponseBodyRelatedRedemptions +from voucherify.models.redemptions_get_response_body_related_redemptions_redemptions_item import RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_get_response_body_related_redemptions_rollbacks_item import RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem +from voucherify.models.redemptions_get_response_body_voucher import RedemptionsGetResponseBodyVoucher +from voucherify.models.redemptions_get_response_body_voucher_gift import RedemptionsGetResponseBodyVoucherGift +from voucherify.models.redemptions_get_response_body_voucher_loyalty_card import RedemptionsGetResponseBodyVoucherLoyaltyCard +from voucherify.models.redemptions_get_response_body_voucher_publish import RedemptionsGetResponseBodyVoucherPublish +from voucherify.models.redemptions_get_response_body_voucher_redemption import RedemptionsGetResponseBodyVoucherRedemption +from voucherify.models.redemptions_list_response_body import RedemptionsListResponseBody +from voucherify.models.redemptions_list_response_body_redemptions_item import RedemptionsListResponseBodyRedemptionsItem +from voucherify.models.redemptions_list_response_body_redemptions_item_channel import RedemptionsListResponseBodyRedemptionsItemChannel +from voucherify.models.redemptions_list_response_body_redemptions_item_customer import RedemptionsListResponseBodyRedemptionsItemCustomer +from voucherify.models.redemptions_list_response_body_redemptions_item_gift import RedemptionsListResponseBodyRedemptionsItemGift +from voucherify.models.redemptions_list_response_body_redemptions_item_loyalty_card import RedemptionsListResponseBodyRedemptionsItemLoyaltyCard +from voucherify.models.redemptions_list_response_body_redemptions_item_order import RedemptionsListResponseBodyRedemptionsItemOrder +from voucherify.models.redemptions_list_response_body_redemptions_item_order_customer import RedemptionsListResponseBodyRedemptionsItemOrderCustomer +from voucherify.models.redemptions_list_response_body_redemptions_item_order_referrer import RedemptionsListResponseBodyRedemptionsItemOrderReferrer +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier import RedemptionsListResponseBodyRedemptionsItemPromotionTier +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_action import RedemptionsListResponseBodyRedemptionsItemPromotionTierAction +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_campaign import RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher import RedemptionsListResponseBodyRedemptionsItemVoucher +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_gift import RedemptionsListResponseBodyRedemptionsItemVoucherGift +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_loyalty_card import RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_publish import RedemptionsListResponseBodyRedemptionsItemVoucherPublish +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_redemption import RedemptionsListResponseBodyRedemptionsItemVoucherRedemption +from voucherify.models.redemptions_redeem_request_body import RedemptionsRedeemRequestBody +from voucherify.models.redemptions_redeem_request_body_options import RedemptionsRedeemRequestBodyOptions +from voucherify.models.redemptions_redeem_request_body_redeemables_item import RedemptionsRedeemRequestBodyRedeemablesItem +from voucherify.models.redemptions_redeem_request_body_redeemables_item_gift import RedemptionsRedeemRequestBodyRedeemablesItemGift +from voucherify.models.redemptions_redeem_request_body_redeemables_item_reward import RedemptionsRedeemRequestBodyRedeemablesItemReward +from voucherify.models.redemptions_redeem_response_body import RedemptionsRedeemResponseBody +from voucherify.models.redemptions_rollback_create_request_body import RedemptionsRollbackCreateRequestBody +from voucherify.models.redemptions_rollback_create_response_body import RedemptionsRollbackCreateResponseBody +from voucherify.models.redemptions_rollback_create_response_body_channel import RedemptionsRollbackCreateResponseBodyChannel +from voucherify.models.redemptions_rollback_create_response_body_gift import RedemptionsRollbackCreateResponseBodyGift +from voucherify.models.redemptions_rollback_create_response_body_loyalty_card import RedemptionsRollbackCreateResponseBodyLoyaltyCard +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions import RedemptionsRollbackCreateResponseBodyRelatedRedemptions +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions_redemptions_item import RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions_rollbacks_item import RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem +from voucherify.models.redemptions_rollbacks_create_request_body import RedemptionsRollbacksCreateRequestBody +from voucherify.models.redemptions_rollbacks_create_response_body import RedemptionsRollbacksCreateResponseBody +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.referral_program_custom_event import ReferralProgramCustomEvent +from voucherify.models.referral_program_referee_reward import ReferralProgramRefereeReward +from voucherify.models.referral_program_referee_reward_related_object_parent import ReferralProgramRefereeRewardRelatedObjectParent +from voucherify.models.referrer import Referrer +from voucherify.models.referrer_address import ReferrerAddress +from voucherify.models.referrer_id import ReferrerId +from voucherify.models.resource_types import ResourceTypes +from voucherify.models.reward import Reward +from voucherify.models.reward_assignment import RewardAssignment +from voucherify.models.reward_assignment_parameters import RewardAssignmentParameters +from voucherify.models.reward_assignment_parameters_loyalty import RewardAssignmentParametersLoyalty +from voucherify.models.reward_attributes import RewardAttributes +from voucherify.models.reward_type import RewardType +from voucherify.models.reward_type_campaign import RewardTypeCampaign +from voucherify.models.reward_type_coin import RewardTypeCoin +from voucherify.models.reward_type_product import RewardTypeProduct +from voucherify.models.rewards_assignments_create_request_body import RewardsAssignmentsCreateRequestBody +from voucherify.models.rewards_assignments_create_request_body_parameters import RewardsAssignmentsCreateRequestBodyParameters +from voucherify.models.rewards_assignments_create_request_body_parameters_loyalty import RewardsAssignmentsCreateRequestBodyParametersLoyalty +from voucherify.models.rewards_assignments_create_response_body import RewardsAssignmentsCreateResponseBody +from voucherify.models.rewards_assignments_create_response_body_parameters import RewardsAssignmentsCreateResponseBodyParameters +from voucherify.models.rewards_assignments_create_response_body_parameters_loyalty import RewardsAssignmentsCreateResponseBodyParametersLoyalty +from voucherify.models.rewards_assignments_get_response_body import RewardsAssignmentsGetResponseBody +from voucherify.models.rewards_assignments_get_response_body_parameters import RewardsAssignmentsGetResponseBodyParameters +from voucherify.models.rewards_assignments_get_response_body_parameters_loyalty import RewardsAssignmentsGetResponseBodyParametersLoyalty +from voucherify.models.rewards_assignments_list_response_body import RewardsAssignmentsListResponseBody +from voucherify.models.rewards_assignments_update_request_body import RewardsAssignmentsUpdateRequestBody +from voucherify.models.rewards_assignments_update_request_body_parameters import RewardsAssignmentsUpdateRequestBodyParameters +from voucherify.models.rewards_assignments_update_request_body_parameters_loyalty import RewardsAssignmentsUpdateRequestBodyParametersLoyalty +from voucherify.models.rewards_assignments_update_response_body import RewardsAssignmentsUpdateResponseBody +from voucherify.models.rewards_assignments_update_response_body_parameters import RewardsAssignmentsUpdateResponseBodyParameters +from voucherify.models.rewards_assignments_update_response_body_parameters_loyalty import RewardsAssignmentsUpdateResponseBodyParametersLoyalty +from voucherify.models.rewards_create_request_body import RewardsCreateRequestBody +from voucherify.models.rewards_create_request_body_attributes import RewardsCreateRequestBodyAttributes +from voucherify.models.rewards_create_request_body_parameters import RewardsCreateRequestBodyParameters +from voucherify.models.rewards_create_request_body_parameters_campaign import RewardsCreateRequestBodyParametersCampaign +from voucherify.models.rewards_create_request_body_parameters_coin import RewardsCreateRequestBodyParametersCoin +from voucherify.models.rewards_create_request_body_parameters_product import RewardsCreateRequestBodyParametersProduct +from voucherify.models.rewards_create_response_body import RewardsCreateResponseBody +from voucherify.models.rewards_create_response_body_attributes import RewardsCreateResponseBodyAttributes +from voucherify.models.rewards_list_response_body import RewardsListResponseBody +from voucherify.models.rewards_update_request_body import RewardsUpdateRequestBody +from voucherify.models.rewards_update_request_body_attributes import RewardsUpdateRequestBodyAttributes +from voucherify.models.rewards_update_request_body_parameters import RewardsUpdateRequestBodyParameters +from voucherify.models.rewards_update_request_body_parameters_campaign import RewardsUpdateRequestBodyParametersCampaign +from voucherify.models.rewards_update_request_body_parameters_coin import RewardsUpdateRequestBodyParametersCoin +from voucherify.models.rewards_update_request_body_parameters_product import RewardsUpdateRequestBodyParametersProduct +from voucherify.models.rewards_update_response_body import RewardsUpdateResponseBody +from voucherify.models.rewards_update_response_body_attributes import RewardsUpdateResponseBodyAttributes +from voucherify.models.segments_create_request_body import SegmentsCreateRequestBody +from voucherify.models.segments_create_response_body import SegmentsCreateResponseBody +from voucherify.models.segments_get_response_body import SegmentsGetResponseBody +from voucherify.models.session import Session +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.simple_customer_required_object_type import SimpleCustomerRequiredObjectType +from voucherify.models.simple_loyalty_card import SimpleLoyaltyCard +from voucherify.models.simple_product_discount_unit import SimpleProductDiscountUnit +from voucherify.models.simple_segment import SimpleSegment +from voucherify.models.simple_sku_discount_unit import SimpleSkuDiscountUnit +from voucherify.models.simple_voucher import SimpleVoucher +from voucherify.models.simple_voucher_redemption import SimpleVoucherRedemption +from voucherify.models.sku import Sku +from voucherify.models.skus_get_response_body import SkusGetResponseBody +from voucherify.models.skus_import_csv_create_response_body import SkusImportCsvCreateResponseBody +from voucherify.models.skus_list_for_product import SkusListForProduct +from voucherify.models.stacking_rules import StackingRules +from voucherify.models.validation_rule import ValidationRule +from voucherify.models.validation_rule_applicable_to import ValidationRuleApplicableTo +from voucherify.models.validation_rule_assignment import ValidationRuleAssignment +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validation_rule_error import ValidationRuleError +from voucherify.models.validation_rules_assignments_create_request_body import ValidationRulesAssignmentsCreateRequestBody +from voucherify.models.validation_rules_assignments_create_response_body import ValidationRulesAssignmentsCreateResponseBody +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validation_rules_assignments_list_response_body import ValidationRulesAssignmentsListResponseBody +from voucherify.models.validation_rules_create_request_body import ValidationRulesCreateRequestBody +from voucherify.models.validation_rules_create_request_body_applicable_to import ValidationRulesCreateRequestBodyApplicableTo +from voucherify.models.validation_rules_create_request_body_error import ValidationRulesCreateRequestBodyError +from voucherify.models.validation_rules_create_response_body import ValidationRulesCreateResponseBody +from voucherify.models.validation_rules_create_response_body_applicable_to import ValidationRulesCreateResponseBodyApplicableTo +from voucherify.models.validation_rules_create_response_body_error import ValidationRulesCreateResponseBodyError +from voucherify.models.validation_rules_get_response_body import ValidationRulesGetResponseBody +from voucherify.models.validation_rules_get_response_body_applicable_to import ValidationRulesGetResponseBodyApplicableTo +from voucherify.models.validation_rules_get_response_body_error import ValidationRulesGetResponseBodyError +from voucherify.models.validation_rules_list_response_body import ValidationRulesListResponseBody +from voucherify.models.validation_rules_update_request_body import ValidationRulesUpdateRequestBody +from voucherify.models.validation_rules_update_request_body_applicable_to import ValidationRulesUpdateRequestBodyApplicableTo +from voucherify.models.validation_rules_update_request_body_error import ValidationRulesUpdateRequestBodyError +from voucherify.models.validation_rules_update_response_body import ValidationRulesUpdateResponseBody +from voucherify.models.validation_rules_update_response_body_applicable_to import ValidationRulesUpdateResponseBodyApplicableTo +from voucherify.models.validation_rules_update_response_body_error import ValidationRulesUpdateResponseBodyError +from voucherify.models.validations_redeemable_inapplicable import ValidationsRedeemableInapplicable +from voucherify.models.validations_redeemable_inapplicable_result import ValidationsRedeemableInapplicableResult +from voucherify.models.validations_redeemable_inapplicable_result_details import ValidationsRedeemableInapplicableResultDetails +from voucherify.models.validations_redeemable_skipped import ValidationsRedeemableSkipped +from voucherify.models.validations_redeemable_skipped_result import ValidationsRedeemableSkippedResult +from voucherify.models.validations_redeemable_skipped_result_details import ValidationsRedeemableSkippedResultDetails +from voucherify.models.validations_validate_request_body import ValidationsValidateRequestBody +from voucherify.models.validations_validate_request_body_options import ValidationsValidateRequestBodyOptions +from voucherify.models.validations_validate_request_body_redeemables_item import ValidationsValidateRequestBodyRedeemablesItem +from voucherify.models.validations_validate_request_body_redeemables_item_gift import ValidationsValidateRequestBodyRedeemablesItemGift +from voucherify.models.validations_validate_request_body_redeemables_item_reward import ValidationsValidateRequestBodyRedeemablesItemReward +from voucherify.models.validations_validate_response_body import ValidationsValidateResponseBody +from voucherify.models.validations_validate_response_body_redeemables_item import ValidationsValidateResponseBodyRedeemablesItem +from voucherify.models.validations_validate_response_body_redeemables_item_result import ValidationsValidateResponseBodyRedeemablesItemResult +from voucherify.models.validations_validate_response_body_redeemables_item_result_details import ValidationsValidateResponseBodyRedeemablesItemResultDetails +from voucherify.models.validations_validate_response_body_redeemables_item_result_discount import ValidationsValidateResponseBodyRedeemablesItemResultDiscount +from voucherify.models.validations_validate_response_body_redeemables_item_result_discount_product import ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct +from voucherify.models.validations_validate_response_body_redeemables_item_result_gift import ValidationsValidateResponseBodyRedeemablesItemResultGift +from voucherify.models.validations_validate_response_body_redeemables_item_result_loyalty_card import ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_hours_daily_item import ValidityHoursDailyItem +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher import Voucher +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.voucher_assets_barcode import VoucherAssetsBarcode +from voucherify.models.voucher_assets_qr import VoucherAssetsQr +from voucherify.models.voucher_gift import VoucherGift +from voucherify.models.voucher_loyalty_card import VoucherLoyaltyCard +from voucherify.models.voucher_publish import VoucherPublish +from voucherify.models.voucher_redemption import VoucherRedemption +from voucherify.models.voucher_transaction import VoucherTransaction +from voucherify.models.voucher_transaction_details import VoucherTransactionDetails +from voucherify.models.voucher_transaction_details_balance import VoucherTransactionDetailsBalance +from voucherify.models.voucher_transaction_details_balance_related_object import VoucherTransactionDetailsBalanceRelatedObject +from voucherify.models.voucher_transaction_details_custom_event import VoucherTransactionDetailsCustomEvent +from voucherify.models.voucher_transaction_details_earning_rule import VoucherTransactionDetailsEarningRule +from voucherify.models.voucher_transaction_details_earning_rule_source import VoucherTransactionDetailsEarningRuleSource +from voucherify.models.voucher_transaction_details_event import VoucherTransactionDetailsEvent +from voucherify.models.voucher_transaction_details_event_schema import VoucherTransactionDetailsEventSchema +from voucherify.models.voucher_transaction_details_loyalty_tier import VoucherTransactionDetailsLoyaltyTier +from voucherify.models.voucher_transaction_details_order import VoucherTransactionDetailsOrder +from voucherify.models.voucher_transaction_details_redemption import VoucherTransactionDetailsRedemption +from voucherify.models.voucher_transaction_details_reward import VoucherTransactionDetailsReward +from voucherify.models.voucher_transaction_details_rollback import VoucherTransactionDetailsRollback +from voucherify.models.voucher_transaction_details_segment import VoucherTransactionDetailsSegment +from voucherify.models.voucher_transactions_export_filter_conditions import VoucherTransactionsExportFilterConditions +from voucherify.models.voucher_transactions_export_filter_conditions_voucher_id import VoucherTransactionsExportFilterConditionsVoucherId +from voucherify.models.voucher_transactions_export_filter_conditions_voucher_id_conditions import VoucherTransactionsExportFilterConditionsVoucherIdConditions +from voucherify.models.voucher_transactions_export_parameters import VoucherTransactionsExportParameters +from voucherify.models.voucher_transactions_filters import VoucherTransactionsFilters +from voucherify.models.voucher_with_categories import VoucherWithCategories +from voucherify.models.voucher_with_categories_gift import VoucherWithCategoriesGift +from voucherify.models.voucher_with_categories_loyalty_card import VoucherWithCategoriesLoyaltyCard +from voucherify.models.voucher_with_categories_publish import VoucherWithCategoriesPublish +from voucherify.models.voucher_with_categories_redemption import VoucherWithCategoriesRedemption +from voucherify.models.vouchers_balance_update_request_body import VouchersBalanceUpdateRequestBody +from voucherify.models.vouchers_balance_update_response_body import VouchersBalanceUpdateResponseBody +from voucherify.models.vouchers_balance_update_response_body_related_object import VouchersBalanceUpdateResponseBodyRelatedObject +from voucherify.models.vouchers_create_response_body import VouchersCreateResponseBody +from voucherify.models.vouchers_create_response_body_gift import VouchersCreateResponseBodyGift +from voucherify.models.vouchers_create_response_body_loyalty_card import VouchersCreateResponseBodyLoyaltyCard +from voucherify.models.vouchers_create_response_body_publish import VouchersCreateResponseBodyPublish +from voucherify.models.vouchers_create_response_body_redemption import VouchersCreateResponseBodyRedemption +from voucherify.models.vouchers_create_with_specific_code_request_body import VouchersCreateWithSpecificCodeRequestBody +from voucherify.models.vouchers_create_with_specific_code_request_body_redemption import VouchersCreateWithSpecificCodeRequestBodyRedemption +from voucherify.models.vouchers_disable_response_body import VouchersDisableResponseBody +from voucherify.models.vouchers_disable_response_body_gift import VouchersDisableResponseBodyGift +from voucherify.models.vouchers_disable_response_body_loyalty_card import VouchersDisableResponseBodyLoyaltyCard +from voucherify.models.vouchers_disable_response_body_publish import VouchersDisableResponseBodyPublish +from voucherify.models.vouchers_disable_response_body_redemption import VouchersDisableResponseBodyRedemption +from voucherify.models.vouchers_enable_response_body import VouchersEnableResponseBody +from voucherify.models.vouchers_enable_response_body_gift import VouchersEnableResponseBodyGift +from voucherify.models.vouchers_enable_response_body_loyalty_card import VouchersEnableResponseBodyLoyaltyCard +from voucherify.models.vouchers_enable_response_body_publish import VouchersEnableResponseBodyPublish +from voucherify.models.vouchers_enable_response_body_redemption import VouchersEnableResponseBodyRedemption +from voucherify.models.vouchers_get_response_body import VouchersGetResponseBody +from voucherify.models.vouchers_get_response_body_gift import VouchersGetResponseBodyGift +from voucherify.models.vouchers_get_response_body_loyalty_card import VouchersGetResponseBodyLoyaltyCard +from voucherify.models.vouchers_get_response_body_publish import VouchersGetResponseBodyPublish +from voucherify.models.vouchers_get_response_body_redemption import VouchersGetResponseBodyRedemption +from voucherify.models.vouchers_import_create_item_request_body import VouchersImportCreateItemRequestBody +from voucherify.models.vouchers_import_create_item_request_body_redemption import VouchersImportCreateItemRequestBodyRedemption +from voucherify.models.vouchers_import_create_response_body import VouchersImportCreateResponseBody +from voucherify.models.vouchers_import_csv_create_response_body import VouchersImportCsvCreateResponseBody +from voucherify.models.vouchers_list_response_body import VouchersListResponseBody +from voucherify.models.vouchers_metadata_update_in_bulk_request_body import VouchersMetadataUpdateInBulkRequestBody +from voucherify.models.vouchers_metadata_update_in_bulk_response_body import VouchersMetadataUpdateInBulkResponseBody +from voucherify.models.vouchers_redemption_get_response_body import VouchersRedemptionGetResponseBody +from voucherify.models.vouchers_transactions_export_create_request_body import VouchersTransactionsExportCreateRequestBody +from voucherify.models.vouchers_transactions_export_create_response_body import VouchersTransactionsExportCreateResponseBody +from voucherify.models.vouchers_transactions_export_create_response_body_result import VouchersTransactionsExportCreateResponseBodyResult +from voucherify.models.vouchers_transactions_list_response_body import VouchersTransactionsListResponseBody +from voucherify.models.vouchers_update_in_bulk_item_request_body import VouchersUpdateInBulkItemRequestBody +from voucherify.models.vouchers_update_in_bulk_response_body import VouchersUpdateInBulkResponseBody +from voucherify.models.vouchers_update_request_body import VouchersUpdateRequestBody +from voucherify.models.vouchers_update_response_body import VouchersUpdateResponseBody +from voucherify.models.vouchers_update_response_body_gift import VouchersUpdateResponseBodyGift +from voucherify.models.vouchers_update_response_body_loyalty_card import VouchersUpdateResponseBodyLoyaltyCard +from voucherify.models.vouchers_update_response_body_publish import VouchersUpdateResponseBodyPublish +from voucherify.models.vouchers_update_response_body_redemption import VouchersUpdateResponseBodyRedemption diff --git a/voucherify/models/access_settings_campaign_assignments_list.py b/voucherify/models/access_settings_campaign_assignments_list.py new file mode 100644 index 00000000..222b6a0f --- /dev/null +++ b/voucherify/models/access_settings_campaign_assignments_list.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.area_store_campaign_assignment import AreaStoreCampaignAssignment +from typing import Optional, Set +from typing_extensions import Self + +class AccessSettingsCampaignAssignmentsList(BaseModel): + """ + Lists all assignments of the campaign to areas and stores if the Areas and Stores feature is enabled (Enterprise feature). + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. Default is `list`. This object stores information about campaign assignments to areas and stores") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of campaign assignments.") + data: Optional[List[AreaStoreCampaignAssignment]] = Field(default=None, description="Contains an array of campaign assignments.") + total: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Total number of areas and stores to which the campaign is assigned.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccessSettingsCampaignAssignmentsList 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccessSettingsCampaignAssignmentsList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [AreaStoreCampaignAssignment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/applicable_to.py b/voucherify/models/applicable_to.py new file mode 100644 index 00000000..02246b46 --- /dev/null +++ b/voucherify/models/applicable_to.py @@ -0,0 +1,211 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from voucherify.models.applicable_to_effect import ApplicableToEffect +from typing import Optional, Set +from typing_extensions import Self + +class ApplicableTo(BaseModel): + """ + ApplicableTo + """ # noqa: E501 + object: Optional[StrictStr] = Field(default=None, description="This object stores information about the resource to which the discount is applicable.") + id: Optional[StrictStr] = Field(default=None, description="Unique product collection, product, or SKU identifier assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="The source identifier from your inventory system.") + product_id: Optional[StrictStr] = Field(default=None, description="Parent product's unique ID assigned by Voucherify.") + product_source_id: Optional[StrictStr] = Field(default=None, description="Parent product's source ID from your inventory system.") + strict: Optional[StrictBool] = None + price: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price.") + price_formula: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Formula used to calculate the discounted price of an item.") + effect: ApplicableToEffect + quantity_limit: Optional[StrictInt] = Field(default=None, description="The maximum number of units allowed to be discounted per order line item.") + aggregated_quantity_limit: Optional[StrictInt] = Field(default=None, description="The maximum number of units allowed to be discounted combined across all matched order line items.") + amount_limit: Optional[StrictInt] = Field(default=None, description="Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.") + aggregated_amount_limit: Optional[StrictInt] = Field(default=None, description="Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value)") + order_item_indices: Optional[List[StrictInt]] = Field(default=None, description="Determines the order in which the discount is applied to the products or SKUs sent in the `order` object in the request. The counting begins from `0`.") + repeat: Optional[StrictInt] = Field(default=None, description="Determines the recurrence of the discount, e.g. `\"repeat\": 3` means that the discount is applied to every third item.") + skip_initially: Optional[StrictInt] = Field(default=None, description="Determines how many items are skipped before the discount is applied.") + target: Optional[StrictStr] = Field(default=None, description="Determines to which kinds of objects the discount is applicable. `\"ITEM\"` includes products and SKUs.") + __properties: ClassVar[List[str]] = ["object", "id", "source_id", "product_id", "product_source_id", "strict", "price", "price_formula", "effect", "quantity_limit", "aggregated_quantity_limit", "amount_limit", "aggregated_amount_limit", "order_item_indices", "repeat", "skip_initially", "target"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product', 'sku', 'products_collection']): + raise ValueError("must be one of enum values ('product', 'sku', 'products_collection')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApplicableTo 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if product_source_id (nullable) is None + # and model_fields_set contains the field + if self.product_source_id is None and "product_source_id" in self.model_fields_set: + _dict['product_source_id'] = None + + # set to None if strict (nullable) is None + # and model_fields_set contains the field + if self.strict is None and "strict" in self.model_fields_set: + _dict['strict'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if price_formula (nullable) is None + # and model_fields_set contains the field + if self.price_formula is None and "price_formula" in self.model_fields_set: + _dict['price_formula'] = None + + # set to None if quantity_limit (nullable) is None + # and model_fields_set contains the field + if self.quantity_limit is None and "quantity_limit" in self.model_fields_set: + _dict['quantity_limit'] = None + + # set to None if aggregated_quantity_limit (nullable) is None + # and model_fields_set contains the field + if self.aggregated_quantity_limit is None and "aggregated_quantity_limit" in self.model_fields_set: + _dict['aggregated_quantity_limit'] = None + + # set to None if amount_limit (nullable) is None + # and model_fields_set contains the field + if self.amount_limit is None and "amount_limit" in self.model_fields_set: + _dict['amount_limit'] = None + + # set to None if aggregated_amount_limit (nullable) is None + # and model_fields_set contains the field + if self.aggregated_amount_limit is None and "aggregated_amount_limit" in self.model_fields_set: + _dict['aggregated_amount_limit'] = None + + # set to None if order_item_indices (nullable) is None + # and model_fields_set contains the field + if self.order_item_indices is None and "order_item_indices" in self.model_fields_set: + _dict['order_item_indices'] = None + + # set to None if repeat (nullable) is None + # and model_fields_set contains the field + if self.repeat is None and "repeat" in self.model_fields_set: + _dict['repeat'] = None + + # set to None if skip_initially (nullable) is None + # and model_fields_set contains the field + if self.skip_initially is None and "skip_initially" in self.model_fields_set: + _dict['skip_initially'] = None + + # set to None if target (nullable) is None + # and model_fields_set contains the field + if self.target is None and "target" in self.model_fields_set: + _dict['target'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object"), + "id": obj.get("id"), + "source_id": obj.get("source_id"), + "product_id": obj.get("product_id"), + "product_source_id": obj.get("product_source_id"), + "strict": obj.get("strict"), + "price": obj.get("price"), + "price_formula": obj.get("price_formula"), + "effect": obj.get("effect"), + "quantity_limit": obj.get("quantity_limit"), + "aggregated_quantity_limit": obj.get("aggregated_quantity_limit"), + "amount_limit": obj.get("amount_limit"), + "aggregated_amount_limit": obj.get("aggregated_amount_limit"), + "order_item_indices": obj.get("order_item_indices"), + "repeat": obj.get("repeat"), + "skip_initially": obj.get("skip_initially"), + "target": obj.get("target") + }) + return _obj + + diff --git a/voucherify/models/applicable_to_effect.py b/voucherify/models/applicable_to_effect.py new file mode 100644 index 00000000..6d1341ce --- /dev/null +++ b/voucherify/models/applicable_to_effect.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ApplicableToEffect(str, Enum): + """ + ApplicableToEffect + """ + + """ + allowed enum values + """ + APPLY_TO_EVERY = 'APPLY_TO_EVERY' + APPLY_TO_CHEAPEST = 'APPLY_TO_CHEAPEST' + APPLY_FROM_CHEAPEST = 'APPLY_FROM_CHEAPEST' + APPLY_TO_MOST_EXPENSIVE = 'APPLY_TO_MOST_EXPENSIVE' + APPLY_FROM_MOST_EXPENSIVE = 'APPLY_FROM_MOST_EXPENSIVE' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ApplicableToEffect from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/applicable_to_result_list.py b/voucherify/models/applicable_to_result_list.py new file mode 100644 index 00000000..62b4b26f --- /dev/null +++ b/voucherify/models/applicable_to_result_list.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.applicable_to import ApplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class ApplicableToResultList(BaseModel): + """ + ApplicableToResultList + """ # noqa: E501 + data: Optional[List[ApplicableTo]] = Field(default=None, description="Contains array of items to which the discount can apply.") + total: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Total number of objects defining included products, SKUs, or product collections.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON.") + data_ref: Optional[StrictStr] = Field(default='data', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["data", "total", "object", "data_ref"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApplicableToResultList 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApplicableToResultList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "data": [ApplicableTo.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data' + }) + return _obj + + diff --git a/voucherify/models/area_store_campaign_assignment.py b/voucherify/models/area_store_campaign_assignment.py new file mode 100644 index 00000000..177bde6c --- /dev/null +++ b/voucherify/models/area_store_campaign_assignment.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AreaStoreCampaignAssignment(BaseModel): + """ + An object representing an assignment of a campaign to an area or store. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the campaign assignment.") + area_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the area to which the campaign is assigned.") + area_store_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the store to which the campaign is assigned.") + created_at: Optional[datetime] = Field(default=None, description="Date and time when the assignment was made. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='area_store_campaign_assignment', description="The type of the object represented by JSON. This object stores information about the campaign assignment to areas or stores.") + __properties: ClassVar[List[str]] = ["id", "area_id", "area_store_id", "created_at", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['area_store_campaign_assignment']): + raise ValueError("must be one of enum values ('area_store_campaign_assignment')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AreaStoreCampaignAssignment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if area_id (nullable) is None + # and model_fields_set contains the field + if self.area_id is None and "area_id" in self.model_fields_set: + _dict['area_id'] = None + + # set to None if area_store_id (nullable) is None + # and model_fields_set contains the field + if self.area_store_id is None and "area_store_id" in self.model_fields_set: + _dict['area_store_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AreaStoreCampaignAssignment 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"), + "area_id": obj.get("area_id"), + "area_store_id": obj.get("area_store_id"), + "created_at": obj.get("created_at"), + "object": obj.get("object") if obj.get("object") is not None else 'area_store_campaign_assignment' + }) + return _obj + + diff --git a/voucherify/models/async_action_base.py b/voucherify/models/async_action_base.py new file mode 100644 index 00000000..ad8fb8da --- /dev/null +++ b/voucherify/models/async_action_base.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class AsyncActionBase(BaseModel): + """ + This is an object representing an asynchronous action. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Async action unique ID.") + type: Optional[StrictStr] = Field(default=None, description="Type of async action.") + status: Optional[StrictStr] = Field(default=None, description="Status of the async action. Informs you whether the async action has already been completed.") + operation_status: Optional[StrictStr] = Field(default=None, description="Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format.") + request_id: Optional[StrictStr] = Field(default=None, description="Unique request ID.") + processing_time: Optional[StrictInt] = Field(default=None, description="The length of time it took to process the request in milliseconds.") + progress: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=None, description="% progress to completion of the asynchronous action.") + object: Optional[StrictStr] = Field(default='async_action', description="The type of the object represented by JSON. This object stores information about the `async_action`.") + __properties: ClassVar[List[str]] = ["id", "type", "status", "operation_status", "created_at", "updated_at", "request_id", "processing_time", "progress", "object"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'ENQUEUED', 'FAILED', 'IN_PROGRESS']): + raise ValueError("must be one of enum values ('DONE', 'ENQUEUED', 'FAILED', 'IN_PROGRESS')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['async_action']): + raise ValueError("must be one of enum values ('async_action')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AsyncActionBase 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if operation_status (nullable) is None + # and model_fields_set contains the field + if self.operation_status is None and "operation_status" in self.model_fields_set: + _dict['operation_status'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if request_id (nullable) is None + # and model_fields_set contains the field + if self.request_id is None and "request_id" in self.model_fields_set: + _dict['request_id'] = None + + # set to None if processing_time (nullable) is None + # and model_fields_set contains the field + if self.processing_time is None and "processing_time" in self.model_fields_set: + _dict['processing_time'] = None + + # set to None if progress (nullable) is None + # and model_fields_set contains the field + if self.progress is None and "progress" in self.model_fields_set: + _dict['progress'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AsyncActionBase 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"), + "type": obj.get("type"), + "status": obj.get("status"), + "operation_status": obj.get("operation_status"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "request_id": obj.get("request_id"), + "processing_time": obj.get("processing_time"), + "progress": obj.get("progress"), + "object": obj.get("object") if obj.get("object") is not None else 'async_action' + }) + return _obj + + diff --git a/voucherify/models/async_action_get_response_body.py b/voucherify/models/async_action_get_response_body.py new file mode 100644 index 00000000..555b2a21 --- /dev/null +++ b/voucherify/models/async_action_get_response_body.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class AsyncActionGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/async-actions/{asyncActionId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Async action unique ID.") + type: Optional[StrictStr] = Field(default=None, description="Type of async action.") + status: Optional[StrictStr] = Field(default=None, description="Status of the async action. Informs you whether the async action has already been completed.") + operation_status: Optional[StrictStr] = Field(default=None, description="Status of async action processing. Informs about the async action status, whether it failed, succeeded, or the status is unknown.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the async action was updated. The value is shown in the ISO 8601 format.") + request_id: Optional[StrictStr] = Field(default=None, description="Unique request ID.") + processing_time: Optional[StrictInt] = Field(default=None, description="The length of time it took to process the request in milliseconds.") + progress: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=None, description="% progress to completion of the asynchronous action.") + object: Optional[StrictStr] = Field(default='async_action', description="The type of the object represented by JSON. This object stores information about the `async_action`.") + result: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "type", "status", "operation_status", "created_at", "updated_at", "request_id", "processing_time", "progress", "object", "result"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'ENQUEUED', 'FAILED', 'IN_PROGRESS']): + raise ValueError("must be one of enum values ('DONE', 'ENQUEUED', 'FAILED', 'IN_PROGRESS')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['async_action']): + raise ValueError("must be one of enum values ('async_action')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AsyncActionGetResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if operation_status (nullable) is None + # and model_fields_set contains the field + if self.operation_status is None and "operation_status" in self.model_fields_set: + _dict['operation_status'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if request_id (nullable) is None + # and model_fields_set contains the field + if self.request_id is None and "request_id" in self.model_fields_set: + _dict['request_id'] = None + + # set to None if processing_time (nullable) is None + # and model_fields_set contains the field + if self.processing_time is None and "processing_time" in self.model_fields_set: + _dict['processing_time'] = None + + # set to None if progress (nullable) is None + # and model_fields_set contains the field + if self.progress is None and "progress" in self.model_fields_set: + _dict['progress'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AsyncActionGetResponseBody 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"), + "type": obj.get("type"), + "status": obj.get("status"), + "operation_status": obj.get("operation_status"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "request_id": obj.get("request_id"), + "processing_time": obj.get("processing_time"), + "progress": obj.get("progress"), + "object": obj.get("object") if obj.get("object") is not None else 'async_action', + "result": obj.get("result") + }) + return _obj + + diff --git a/voucherify/models/async_actions_list_response_body.py b/voucherify/models/async_actions_list_response_body.py new file mode 100644 index 00000000..7724aee5 --- /dev/null +++ b/voucherify/models/async_actions_list_response_body.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.async_action_base import AsyncActionBase +from typing import Optional, Set +from typing_extensions import Self + +class AsyncActionsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/async-actions`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about asynchronous actions.") + data_ref: Optional[StrictStr] = Field(default='async_actions', description="Identifies the name of the JSON property that contains the array of asynchronous actions.") + async_actions: Optional[List[AsyncActionBase]] = None + __properties: ClassVar[List[str]] = ["object", "data_ref", "async_actions"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['async_actions']): + raise ValueError("must be one of enum values ('async_actions')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AsyncActionsListResponseBody 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 async_actions (list) + _items = [] + if self.async_actions: + for _item_async_actions in self.async_actions: + if _item_async_actions: + _items.append(_item_async_actions.to_dict()) + _dict['async_actions'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if async_actions (nullable) is None + # and model_fields_set contains the field + if self.async_actions is None and "async_actions" in self.model_fields_set: + _dict['async_actions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AsyncActionsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'async_actions', + "async_actions": [AsyncActionBase.from_dict(_item) for _item in obj["async_actions"]] if obj.get("async_actions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/bus_val_rule_assignment.py b/voucherify/models/bus_val_rule_assignment.py new file mode 100644 index 00000000..a333c01f --- /dev/null +++ b/voucherify/models/bus_val_rule_assignment.py @@ -0,0 +1,170 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class BusValRuleAssignment(BaseModel): + """ + Assignments of business validation rule + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The unique identifier for a assignment") + rule_id: Optional[StrictStr] = Field(default=None, description="The unique identifier for a rule") + related_object_id: Optional[StrictStr] = Field(default=None, description="The unique identifier for a related object") + related_object_type: Optional[StrictStr] = Field(default=None, description="The type of related object") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was last updated in ISO 8601 format.") + object: Optional[StrictStr] = Field(default='validation_rules_assignment', description="The type of the object represented by JSON.") + validation_status: Optional[StrictStr] = Field(default=None, description="The validation status of the assignment") + validation_omitted_rules: Optional[List[StrictStr]] = Field(default=None, description="The list of omitted rules") + __properties: ClassVar[List[str]] = ["id", "rule_id", "related_object_id", "related_object_type", "created_at", "updated_at", "object", "validation_status", "validation_omitted_rules"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['validation_rules_assignment']): + raise ValueError("must be one of enum values ('validation_rules_assignment')") + return value + + @field_validator('validation_status') + def validation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['VALID', 'PARTIALLY_VALID', 'INVALID']): + raise ValueError("must be one of enum values ('VALID', 'PARTIALLY_VALID', 'INVALID')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BusValRuleAssignment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if rule_id (nullable) is None + # and model_fields_set contains the field + if self.rule_id is None and "rule_id" in self.model_fields_set: + _dict['rule_id'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if validation_status (nullable) is None + # and model_fields_set contains the field + if self.validation_status is None and "validation_status" in self.model_fields_set: + _dict['validation_status'] = None + + # set to None if validation_omitted_rules (nullable) is None + # and model_fields_set contains the field + if self.validation_omitted_rules is None and "validation_omitted_rules" in self.model_fields_set: + _dict['validation_omitted_rules'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BusValRuleAssignment 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"), + "rule_id": obj.get("rule_id"), + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'validation_rules_assignment', + "validation_status": obj.get("validation_status"), + "validation_omitted_rules": obj.get("validation_omitted_rules") + }) + return _obj + + diff --git a/voucherify/models/campaign_base.py b/voucherify/models/campaign_base.py new file mode 100644 index 00000000..23bccc94 --- /dev/null +++ b/voucherify/models/campaign_base.py @@ -0,0 +1,339 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaign_voucher import CampaignVoucher +from voucherify.models.category import Category +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignBase(BaseModel): + """ + This is an object representing a campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default=None, description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[CampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + referral_program: Optional[ReferralProgram] = None + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "referral_program", "loyalty_tiers_expiration"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignBase 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of referral_program + if self.referral_program: + _dict['referral_program'] = self.referral_program.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignBase 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type"), + "type": obj.get("type"), + "voucher": CampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "referral_program": ReferralProgram.from_dict(obj["referral_program"]) if obj.get("referral_program") is not None else None, + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaign_loyalty_card.py b/voucherify/models/campaign_loyalty_card.py new file mode 100644 index 00000000..850db22e --- /dev/null +++ b/voucherify/models/campaign_loyalty_card.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaign_loyalty_card_expiration_rules import CampaignLoyaltyCardExpirationRules +from typing import Optional, Set +from typing_extensions import Self + +class CampaignLoyaltyCard(BaseModel): + """ + Schema model for a campaign loyalty card. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card.") + expiration_rules: Optional[CampaignLoyaltyCardExpirationRules] = None + __properties: ClassVar[List[str]] = ["points", "expiration_rules"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignLoyaltyCard 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 expiration_rules + if self.expiration_rules: + _dict['expiration_rules'] = self.expiration_rules.to_dict() + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if expiration_rules (nullable) is None + # and model_fields_set contains the field + if self.expiration_rules is None and "expiration_rules" in self.model_fields_set: + _dict['expiration_rules'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "expiration_rules": CampaignLoyaltyCardExpirationRules.from_dict(obj["expiration_rules"]) if obj.get("expiration_rules") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaign_loyalty_card_expiration_rules.py b/voucherify/models/campaign_loyalty_card_expiration_rules.py new file mode 100644 index 00000000..713bf0b5 --- /dev/null +++ b/voucherify/models/campaign_loyalty_card_expiration_rules.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class CampaignLoyaltyCardExpirationRules(BaseModel): + """ + CampaignLoyaltyCardExpirationRules + """ # noqa: E501 + period_type: Optional[StrictStr] = Field(default='MONTH', description="Type of period") + period_value: Optional[StrictInt] = Field(default=None, description="Value of the period") + rounding_type: Optional[StrictStr] = Field(default=None, description="Type of rounding") + rounding_value: Optional[StrictInt] = Field(default=None, description="Value of rounding") + __properties: ClassVar[List[str]] = ["period_type", "period_value", "rounding_type", "rounding_value"] + + @field_validator('period_type') + def period_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MONTH']): + raise ValueError("must be one of enum values ('MONTH')") + return value + + @field_validator('rounding_type') + def rounding_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['END_OF_MONTH', 'END_OF_QUARTER', 'END_OF_HALF_YEAR', 'END_OF_YEAR', 'PARTICULAR_MONTH']): + raise ValueError("must be one of enum values ('END_OF_MONTH', 'END_OF_QUARTER', 'END_OF_HALF_YEAR', 'END_OF_YEAR', 'PARTICULAR_MONTH')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignLoyaltyCardExpirationRules 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, + ) + # set to None if period_type (nullable) is None + # and model_fields_set contains the field + if self.period_type is None and "period_type" in self.model_fields_set: + _dict['period_type'] = None + + # set to None if period_value (nullable) is None + # and model_fields_set contains the field + if self.period_value is None and "period_value" in self.model_fields_set: + _dict['period_value'] = None + + # set to None if rounding_type (nullable) is None + # and model_fields_set contains the field + if self.rounding_type is None and "rounding_type" in self.model_fields_set: + _dict['rounding_type'] = None + + # set to None if rounding_value (nullable) is None + # and model_fields_set contains the field + if self.rounding_value is None and "rounding_value" in self.model_fields_set: + _dict['rounding_value'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignLoyaltyCardExpirationRules from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "period_type": obj.get("period_type") if obj.get("period_type") is not None else 'MONTH', + "period_value": obj.get("period_value"), + "rounding_type": obj.get("rounding_type"), + "rounding_value": obj.get("rounding_value") + }) + return _obj + + diff --git a/voucherify/models/campaign_loyalty_voucher.py b/voucherify/models/campaign_loyalty_voucher.py new file mode 100644 index 00000000..00d7f657 --- /dev/null +++ b/voucherify/models/campaign_loyalty_voucher.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.campaign_loyalty_card import CampaignLoyaltyCard +from voucherify.models.campaign_loyalty_voucher_redemption import CampaignLoyaltyVoucherRedemption +from voucherify.models.code_config import CodeConfig +from typing import Optional, Set +from typing_extensions import Self + +class CampaignLoyaltyVoucher(BaseModel): + """ + Schema model for a discount voucher. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default='LOYALTY_CARD', description="Type of voucher.") + loyalty_card: CampaignLoyaltyCard + redemption: Optional[CampaignLoyaltyVoucherRedemption] = None + code_config: Optional[CodeConfig] = None + __properties: ClassVar[List[str]] = ["type", "loyalty_card", "redemption", "code_config"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD']): + raise ValueError("must be one of enum values ('LOYALTY_CARD')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignLoyaltyVoucher 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 loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of code_config + if self.code_config: + _dict['code_config'] = self.code_config.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignLoyaltyVoucher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") if obj.get("type") is not None else 'LOYALTY_CARD', + "loyalty_card": CampaignLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "redemption": CampaignLoyaltyVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "code_config": CodeConfig.from_dict(obj["code_config"]) if obj.get("code_config") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaign_loyalty_voucher_redemption.py b/voucherify/models/campaign_loyalty_voucher_redemption.py new file mode 100644 index 00000000..c82fb13f --- /dev/null +++ b/voucherify/models/campaign_loyalty_voucher_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignLoyaltyVoucherRedemption(BaseModel): + """ + Defines the redemption limits on vouchers. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignLoyaltyVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignLoyaltyVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/campaign_voucher.py b/voucherify/models/campaign_voucher.py new file mode 100644 index 00000000..576a0074 --- /dev/null +++ b/voucherify/models/campaign_voucher.py @@ -0,0 +1,175 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaign_loyalty_card import CampaignLoyaltyCard +from voucherify.models.campaign_voucher_redemption import CampaignVoucherRedemption +from voucherify.models.code_config import CodeConfig +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignVoucher(BaseModel): + """ + Schema model for a campaign voucher. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="Type of voucher.") + discount: Optional[Discount] = None + gift: Optional[Gift] = None + loyalty_card: Optional[CampaignLoyaltyCard] = None + redemption: Optional[CampaignVoucherRedemption] = None + code_config: CodeConfig + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + __properties: ClassVar[List[str]] = ["type", "discount", "gift", "loyalty_card", "redemption", "code_config", "is_referral_code", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of code_config + if self.code_config: + _dict['code_config'] = self.code_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignVoucher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": CampaignLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "redemption": CampaignVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "code_config": CodeConfig.from_dict(obj["code_config"]) if obj.get("code_config") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaign_voucher_redemption.py b/voucherify/models/campaign_voucher_redemption.py new file mode 100644 index 00000000..8f4d4ddf --- /dev/null +++ b/voucherify/models/campaign_voucher_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignVoucherRedemption(BaseModel): + """ + Defines the redemption limits on vouchers. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/campaigns_create_request_body.py b/voucherify/models/campaigns_create_request_body.py new file mode 100644 index 00000000..b59271a8 --- /dev/null +++ b/voucherify/models/campaigns_create_request_body.py @@ -0,0 +1,272 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.campaigns_create_request_body_promotion import CampaignsCreateRequestBodyPromotion +from voucherify.models.campaigns_create_request_body_voucher import CampaignsCreateRequestBodyVoucher +from voucherify.models.lucky_draw import LuckyDraw +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsCreateRequestBody(BaseModel): + """ + CampaignsCreateRequestBody + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign (size of campaign).") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + validation_rules: Optional[Annotated[List[StrictStr], Field(max_length=1)]] = Field(default=None, description="Array containing the ID of the validation rule associated with the promotion tier.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.") + category: Optional[StrictStr] = Field(default=None, description="The category assigned to the campaign. Either pass this parameter OR the `category_id`.") + metadata: Optional[Dict[str, Any]] = None + campaign_type: Optional[StrictStr] = None + voucher: Optional[CampaignsCreateRequestBodyVoucher] = None + referral_program: Optional[ReferralProgram] = None + promotion: Optional[CampaignsCreateRequestBodyPromotion] = None + lucky_draw: Optional[LuckyDraw] = None + __properties: ClassVar[List[str]] = ["name", "description", "type", "join_once", "auto_join", "use_voucher_metadata_schema", "vouchers_count", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "validation_rules", "category_id", "category", "metadata", "campaign_type", "voucher", "referral_program", "promotion", "lucky_draw"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DISCOUNT_COUPONS', 'REFERRAL_PROGRAM', 'GIFT_VOUCHERS', 'LOYALTY_PROGRAM', 'PROMOTION', 'LUCKY_DRAW']): + raise ValueError("must be one of enum values ('DISCOUNT_COUPONS', 'REFERRAL_PROGRAM', 'GIFT_VOUCHERS', 'LOYALTY_PROGRAM', 'PROMOTION', 'LUCKY_DRAW')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBody 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of referral_program + if self.referral_program: + _dict['referral_program'] = self.referral_program.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion + if self.promotion: + _dict['promotion'] = self.promotion.to_dict() + # override the default output from pydantic by calling `to_dict()` of lucky_draw + if self.lucky_draw: + _dict['lucky_draw'] = self.lucky_draw.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if validation_rules (nullable) is None + # and model_fields_set contains the field + if self.validation_rules is None and "validation_rules" in self.model_fields_set: + _dict['validation_rules'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if voucher (nullable) is None + # and model_fields_set contains the field + if self.voucher is None and "voucher" in self.model_fields_set: + _dict['voucher'] = None + + # set to None if promotion (nullable) is None + # and model_fields_set contains the field + if self.promotion is None and "promotion" in self.model_fields_set: + _dict['promotion'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBody 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"), + "type": obj.get("type"), + "join_once": obj.get("join_once"), + "auto_join": obj.get("auto_join"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "validation_rules": obj.get("validation_rules"), + "category_id": obj.get("category_id"), + "category": obj.get("category"), + "metadata": obj.get("metadata"), + "campaign_type": obj.get("campaign_type"), + "voucher": CampaignsCreateRequestBodyVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "referral_program": ReferralProgram.from_dict(obj["referral_program"]) if obj.get("referral_program") is not None else None, + "promotion": CampaignsCreateRequestBodyPromotion.from_dict(obj["promotion"]) if obj.get("promotion") is not None else None, + "lucky_draw": LuckyDraw.from_dict(obj["lucky_draw"]) if obj.get("lucky_draw") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_create_request_body_promotion.py b/voucherify/models/campaigns_create_request_body_promotion.py new file mode 100644 index 00000000..002fcae9 --- /dev/null +++ b/voucherify/models/campaigns_create_request_body_promotion.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_tier_create_params import PromotionTierCreateParams +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsCreateRequestBodyPromotion(BaseModel): + """ + CampaignsCreateRequestBodyPromotion + """ # noqa: E501 + tiers: Optional[List[PromotionTierCreateParams]] = None + __properties: ClassVar[List[str]] = ["tiers"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBodyPromotion 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 tiers (list) + _items = [] + if self.tiers: + for _item_tiers in self.tiers: + if _item_tiers: + _items.append(_item_tiers.to_dict()) + _dict['tiers'] = _items + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBodyPromotion from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tiers": [PromotionTierCreateParams.from_dict(_item) for _item in obj["tiers"]] if obj.get("tiers") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_create_request_body_voucher.py b/voucherify/models/campaigns_create_request_body_voucher.py new file mode 100644 index 00000000..397e04a9 --- /dev/null +++ b/voucherify/models/campaigns_create_request_body_voucher.py @@ -0,0 +1,145 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaign_loyalty_card import CampaignLoyaltyCard +from voucherify.models.campaigns_create_request_body_voucher_redemption import CampaignsCreateRequestBodyVoucherRedemption +from voucherify.models.code_config import CodeConfig +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsCreateRequestBodyVoucher(BaseModel): + """ + CampaignsCreateRequestBodyVoucher + """ # noqa: E501 + type: Optional[StrictStr] = None + discount: Optional[Discount] = None + code_config: Optional[CodeConfig] = None + redemption: Optional[CampaignsCreateRequestBodyVoucherRedemption] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + gift: Optional[Gift] = None + loyalty_card: Optional[CampaignLoyaltyCard] = None + __properties: ClassVar[List[str]] = ["type", "discount", "code_config", "redemption", "is_referral_code", "gift", "loyalty_card"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DISCOUNT_VOUCHER', 'GIFT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('DISCOUNT_VOUCHER', 'GIFT_VOUCHER', 'LOYALTY_CARD')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBodyVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of code_config + if self.code_config: + _dict['code_config'] = self.code_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBodyVoucher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "code_config": CodeConfig.from_dict(obj["code_config"]) if obj.get("code_config") is not None else None, + "redemption": CampaignsCreateRequestBodyVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": CampaignLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_create_request_body_voucher_redemption.py b/voucherify/models/campaigns_create_request_body_voucher_redemption.py new file mode 100644 index 00000000..170cad0a --- /dev/null +++ b/voucherify/models/campaigns_create_request_body_voucher_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsCreateRequestBodyVoucherRedemption(BaseModel): + """ + CampaignsCreateRequestBodyVoucherRedemption + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBodyVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsCreateRequestBodyVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/campaigns_create_response_body.py b/voucherify/models/campaigns_create_response_body.py new file mode 100644 index 00000000..dece3870 --- /dev/null +++ b/voucherify/models/campaigns_create_response_body.py @@ -0,0 +1,357 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.campaign_voucher import CampaignVoucher +from voucherify.models.category import Category +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.promotion_tiers_list import PromotionTiersList +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/campaigns/{campaignId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default=None, description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[CampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + referral_program: Optional[ReferralProgram] = None + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + promotion: Optional[PromotionTiersList] = None + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + access_settings_assignments: Optional[AccessSettingsCampaignAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "referral_program", "loyalty_tiers_expiration", "promotion", "validation_rules_assignments", "access_settings_assignments"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsCreateResponseBody 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of referral_program + if self.referral_program: + _dict['referral_program'] = self.referral_program.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion + if self.promotion: + _dict['promotion'] = self.promotion.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of access_settings_assignments + if self.access_settings_assignments: + _dict['access_settings_assignments'] = self.access_settings_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsCreateResponseBody 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type"), + "type": obj.get("type"), + "voucher": CampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "referral_program": ReferralProgram.from_dict(obj["referral_program"]) if obj.get("referral_program") is not None else None, + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "promotion": PromotionTiersList.from_dict(obj["promotion"]) if obj.get("promotion") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "access_settings_assignments": AccessSettingsCampaignAssignmentsList.from_dict(obj["access_settings_assignments"]) if obj.get("access_settings_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_delete_response_body.py b/voucherify/models/campaigns_delete_response_body.py new file mode 100644 index 00000000..f0a3e156 --- /dev/null +++ b/voucherify/models/campaigns_delete_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsDeleteResponseBody(BaseModel): + """ + Response body schema for **DELETE** `/campaigns/{campaignId}`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsDeleteResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsDeleteResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/campaigns_get_response_body.py b/voucherify/models/campaigns_get_response_body.py new file mode 100644 index 00000000..174fd48e --- /dev/null +++ b/voucherify/models/campaigns_get_response_body.py @@ -0,0 +1,357 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.campaign_voucher import CampaignVoucher +from voucherify.models.category import Category +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.promotion_tiers_list import PromotionTiersList +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/campaigns/{campaignId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default=None, description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[CampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + referral_program: Optional[ReferralProgram] = None + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + promotion: Optional[PromotionTiersList] = None + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + access_settings_assignments: Optional[AccessSettingsCampaignAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "referral_program", "loyalty_tiers_expiration", "promotion", "validation_rules_assignments", "access_settings_assignments"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsGetResponseBody 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of referral_program + if self.referral_program: + _dict['referral_program'] = self.referral_program.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion + if self.promotion: + _dict['promotion'] = self.promotion.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of access_settings_assignments + if self.access_settings_assignments: + _dict['access_settings_assignments'] = self.access_settings_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsGetResponseBody 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type"), + "type": obj.get("type"), + "voucher": CampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "referral_program": ReferralProgram.from_dict(obj["referral_program"]) if obj.get("referral_program") is not None else None, + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "promotion": PromotionTiersList.from_dict(obj["promotion"]) if obj.get("promotion") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "access_settings_assignments": AccessSettingsCampaignAssignmentsList.from_dict(obj["access_settings_assignments"]) if obj.get("access_settings_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_import_create_response_body.py b/voucherify/models/campaigns_import_create_response_body.py new file mode 100644 index 00000000..a35883b4 --- /dev/null +++ b/voucherify/models/campaigns_import_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsImportCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/campaigns/{campaignId}/import`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsImportCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsImportCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/campaigns_import_csv_create_response_body.py b/voucherify/models/campaigns_import_csv_create_response_body.py new file mode 100644 index 00000000..4e50fcdf --- /dev/null +++ b/voucherify/models/campaigns_import_csv_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsImportCsvCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/campaigns/{campaignId}/importCSV`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsImportCsvCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsImportCsvCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/campaigns_import_voucher_item.py b/voucherify/models/campaigns_import_voucher_item.py new file mode 100644 index 00000000..7fcd0207 --- /dev/null +++ b/voucherify/models/campaigns_import_voucher_item.py @@ -0,0 +1,201 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaigns_import_voucher_item_redemption import CampaignsImportVoucherItemRedemption +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from voucherify.models.simple_loyalty_card import SimpleLoyaltyCard +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsImportVoucherItem(BaseModel): + """ + CampaignsImportVoucherItem + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Value representing the imported code.") + redemption: Optional[CampaignsImportVoucherItemRedemption] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + metadata: Optional[Dict[str, Any]] = None + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + type: Optional[StrictStr] = None + loyalty_card: Optional[SimpleLoyaltyCard] = None + gift: Optional[Gift] = None + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["code", "redemption", "active", "metadata", "category", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "additional_info", "type", "loyalty_card", "gift", "discount"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD', 'GIFT_VOUCHER', 'DISCOUNT_VOUCHER']): + raise ValueError("must be one of enum values ('LOYALTY_CARD', 'GIFT_VOUCHER', 'DISCOUNT_VOUCHER')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsImportVoucherItem 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 redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsImportVoucherItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "redemption": CampaignsImportVoucherItemRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "category": obj.get("category"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "additional_info": obj.get("additional_info"), + "type": obj.get("type"), + "loyalty_card": SimpleLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_import_voucher_item_redemption.py b/voucherify/models/campaigns_import_voucher_item_redemption.py new file mode 100644 index 00000000..0949f529 --- /dev/null +++ b/voucherify/models/campaigns_import_voucher_item_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsImportVoucherItemRedemption(BaseModel): + """ + CampaignsImportVoucherItemRedemption + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsImportVoucherItemRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsImportVoucherItemRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/campaigns_list_response_body.py b/voucherify/models/campaigns_list_response_body.py new file mode 100644 index 00000000..255ff846 --- /dev/null +++ b/voucherify/models/campaigns_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaign_base import CampaignBase +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsListResponseBody(BaseModel): + """ + Schema model for **GET** `v1/campaigns`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about campaigns in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='campaigns', description="Identifies the name of the attribute that contains the array of campaign objects.") + campaigns: Optional[List[CampaignBase]] = Field(default=None, description="Contains array of campaign objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of campaigns.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "campaigns", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsListResponseBody 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 campaigns (list) + _items = [] + if self.campaigns: + for _item_campaigns in self.campaigns: + if _item_campaigns: + _items.append(_item_campaigns.to_dict()) + _dict['campaigns'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if campaigns (nullable) is None + # and model_fields_set contains the field + if self.campaigns is None and "campaigns" in self.model_fields_set: + _dict['campaigns'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'campaigns', + "campaigns": [CampaignBase.from_dict(_item) for _item in obj["campaigns"]] if obj.get("campaigns") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/campaigns_update_request_body.py b/voucherify/models/campaigns_update_request_body.py new file mode 100644 index 00000000..8e4b4751 --- /dev/null +++ b/voucherify/models/campaigns_update_request_body.py @@ -0,0 +1,257 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.campaigns_update_request_body_options import CampaignsUpdateRequestBodyOptions +from voucherify.models.gift import Gift +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsUpdateRequestBody(BaseModel): + """ + CampaignsUpdateRequestBody + """ # noqa: E501 + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + category: Optional[StrictStr] = Field(default=None, description="The category assigned to the campaign. Either pass this parameter OR the `category_id`.") + metadata: Optional[Dict[str, Any]] = None + unset_metadata_fields: Optional[List[StrictStr]] = Field(default=None, description="Determine which metadata should be removed from campaign.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.") + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published.") + discount: Optional[Dict[str, Any]] = None + referral_program: Optional[ReferralProgram] = None + gift: Optional[Gift] = None + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + options: Optional[CampaignsUpdateRequestBodyOptions] = None + winners_count: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="It represents the total number of winners in a lucky draw.") + unique_winners_per_draw: Optional[StrictStr] = Field(default=None, description="It indicates whether each winner in a draw is unique or not.") + unique_winners: Optional[StrictStr] = Field(default=None, description="Specifies whether each participant can win only once across multiple draws.") + __properties: ClassVar[List[str]] = ["start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "description", "category", "metadata", "unset_metadata_fields", "category_id", "activity_duration_after_publishing", "join_once", "auto_join", "type", "discount", "referral_program", "gift", "loyalty_tiers_expiration", "options", "winners_count", "unique_winners_per_draw", "unique_winners"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsUpdateRequestBody 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of referral_program + if self.referral_program: + _dict['referral_program'] = self.referral_program.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of options + if self.options: + _dict['options'] = self.options.to_dict() + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if unset_metadata_fields (nullable) is None + # and model_fields_set contains the field + if self.unset_metadata_fields is None and "unset_metadata_fields" in self.model_fields_set: + _dict['unset_metadata_fields'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if discount (nullable) is None + # and model_fields_set contains the field + if self.discount is None and "discount" in self.model_fields_set: + _dict['discount'] = None + + # set to None if options (nullable) is None + # and model_fields_set contains the field + if self.options is None and "options" in self.model_fields_set: + _dict['options'] = None + + # set to None if winners_count (nullable) is None + # and model_fields_set contains the field + if self.winners_count is None and "winners_count" in self.model_fields_set: + _dict['winners_count'] = None + + # set to None if unique_winners_per_draw (nullable) is None + # and model_fields_set contains the field + if self.unique_winners_per_draw is None and "unique_winners_per_draw" in self.model_fields_set: + _dict['unique_winners_per_draw'] = None + + # set to None if unique_winners (nullable) is None + # and model_fields_set contains the field + if self.unique_winners is None and "unique_winners" in self.model_fields_set: + _dict['unique_winners'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "description": obj.get("description"), + "category": obj.get("category"), + "metadata": obj.get("metadata"), + "unset_metadata_fields": obj.get("unset_metadata_fields"), + "category_id": obj.get("category_id"), + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "join_once": obj.get("join_once"), + "auto_join": obj.get("auto_join"), + "type": obj.get("type"), + "discount": obj.get("discount"), + "referral_program": ReferralProgram.from_dict(obj["referral_program"]) if obj.get("referral_program") is not None else None, + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "options": CampaignsUpdateRequestBodyOptions.from_dict(obj["options"]) if obj.get("options") is not None else None, + "winners_count": obj.get("winners_count"), + "unique_winners_per_draw": obj.get("unique_winners_per_draw"), + "unique_winners": obj.get("unique_winners") + }) + return _obj + + diff --git a/voucherify/models/campaigns_update_request_body_options.py b/voucherify/models/campaigns_update_request_body_options.py new file mode 100644 index 00000000..8e1b1676 --- /dev/null +++ b/voucherify/models/campaigns_update_request_body_options.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsUpdateRequestBodyOptions(BaseModel): + """ + CampaignsUpdateRequestBodyOptions + """ # noqa: E501 + recalculate_tiers: Optional[StrictBool] = Field(default=None, description="Determine if tiers should be recalculated or no.") + __properties: ClassVar[List[str]] = ["recalculate_tiers"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsUpdateRequestBodyOptions 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, + ) + # set to None if recalculate_tiers (nullable) is None + # and model_fields_set contains the field + if self.recalculate_tiers is None and "recalculate_tiers" in self.model_fields_set: + _dict['recalculate_tiers'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsUpdateRequestBodyOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "recalculate_tiers": obj.get("recalculate_tiers") + }) + return _obj + + diff --git a/voucherify/models/campaigns_update_response_body.py b/voucherify/models/campaigns_update_response_body.py new file mode 100644 index 00000000..066f7517 --- /dev/null +++ b/voucherify/models/campaigns_update_response_body.py @@ -0,0 +1,357 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.campaign_voucher import CampaignVoucher +from voucherify.models.category import Category +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.promotion_tiers_list import PromotionTiersList +from voucherify.models.referral_program import ReferralProgram +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/campaigns/{campaignId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default=None, description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[CampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + referral_program: Optional[ReferralProgram] = None + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + promotion: Optional[PromotionTiersList] = None + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + access_settings_assignments: Optional[AccessSettingsCampaignAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "referral_program", "loyalty_tiers_expiration", "promotion", "validation_rules_assignments", "access_settings_assignments"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsUpdateResponseBody 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of referral_program + if self.referral_program: + _dict['referral_program'] = self.referral_program.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion + if self.promotion: + _dict['promotion'] = self.promotion.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of access_settings_assignments + if self.access_settings_assignments: + _dict['access_settings_assignments'] = self.access_settings_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsUpdateResponseBody 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type"), + "type": obj.get("type"), + "voucher": CampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "referral_program": ReferralProgram.from_dict(obj["referral_program"]) if obj.get("referral_program") is not None else None, + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "promotion": PromotionTiersList.from_dict(obj["promotion"]) if obj.get("promotion") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "access_settings_assignments": AccessSettingsCampaignAssignmentsList.from_dict(obj["access_settings_assignments"]) if obj.get("access_settings_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_combined_response_body.py b/voucherify/models/campaigns_vouchers_create_combined_response_body.py new file mode 100644 index 00000000..893e4ddb --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_combined_response_body.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaigns_vouchers_create_combined_response_body_gift import CampaignsVouchersCreateCombinedResponseBodyGift +from voucherify.models.campaigns_vouchers_create_combined_response_body_loyalty_card import CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard +from voucherify.models.campaigns_vouchers_create_combined_response_body_publish import CampaignsVouchersCreateCombinedResponseBodyPublish +from voucherify.models.campaigns_vouchers_create_combined_response_body_redemption import CampaignsVouchersCreateCombinedResponseBodyRedemption +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateCombinedResponseBody(BaseModel): + """ + CampaignsVouchersCreateCombinedResponseBody + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[CampaignsVouchersCreateCombinedResponseBodyGift] = None + loyalty_card: Optional[CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[CampaignsVouchersCreateCombinedResponseBodyPublish] = None + redemption: Optional[CampaignsVouchersCreateCombinedResponseBodyRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments", "async_action_id"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBody 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": CampaignsVouchersCreateCombinedResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": CampaignsVouchersCreateCombinedResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": CampaignsVouchersCreateCombinedResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_combined_response_body_gift.py b/voucherify/models/campaigns_vouchers_create_combined_response_body_gift.py new file mode 100644 index 00000000..d506eeb1 --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_combined_response_body_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class CampaignsVouchersCreateCombinedResponseBodyGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_combined_response_body_loyalty_card.py b/voucherify/models/campaigns_vouchers_create_combined_response_body_loyalty_card.py new file mode 100644 index 00000000..4833c9ac --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_combined_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_combined_response_body_publish.py b/voucherify/models/campaigns_vouchers_create_combined_response_body_publish.py new file mode 100644 index 00000000..5c3ed9ca --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_combined_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateCombinedResponseBodyPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_combined_response_body_redemption.py b/voucherify/models/campaigns_vouchers_create_combined_response_body_redemption.py new file mode 100644 index 00000000..ba1fbe1f --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_combined_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateCombinedResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateCombinedResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_in_bulk_request_body.py b/voucherify/models/campaigns_vouchers_create_in_bulk_request_body.py new file mode 100644 index 00000000..3e2ab041 --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_in_bulk_request_body.py @@ -0,0 +1,146 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaigns_vouchers_create_in_bulk_request_body_redemption import CampaignsVouchersCreateInBulkRequestBodyRedemption +from voucherify.models.code_config import CodeConfig +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateInBulkRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/campaigns/{campaignId}/vouchers`. + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Unique voucher code.") + code_config: Optional[CodeConfig] = None + category: Optional[StrictStr] = Field(default=None, description="The category assigned to the campaign. Either pass this parameter OR the `category_id`.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + redemption: Optional[CampaignsVouchersCreateInBulkRequestBodyRedemption] = None + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.") + __properties: ClassVar[List[str]] = ["code", "code_config", "category", "metadata", "redemption", "additional_info", "start_date", "expiration_date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateInBulkRequestBody 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 code_config + if self.code_config: + _dict['code_config'] = self.code_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateInBulkRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "code_config": CodeConfig.from_dict(obj["code_config"]) if obj.get("code_config") is not None else None, + "category": obj.get("category"), + "metadata": obj.get("metadata"), + "redemption": CampaignsVouchersCreateInBulkRequestBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "additional_info": obj.get("additional_info"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_in_bulk_request_body_redemption.py b/voucherify/models/campaigns_vouchers_create_in_bulk_request_body_redemption.py new file mode 100644 index 00000000..7591f538 --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_in_bulk_request_body_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateInBulkRequestBodyRedemption(BaseModel): + """ + Stores the quantity of redemptions that can be applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateInBulkRequestBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateInBulkRequestBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_request_body.py b/voucherify/models/campaigns_vouchers_create_request_body.py new file mode 100644 index 00000000..ab65ae0e --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_request_body.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaigns_vouchers_create_request_body_redemption import CampaignsVouchersCreateRequestBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/campaigns/{campaignId}/vouchers/{code}`. + """ # noqa: E501 + category: Optional[StrictStr] = Field(default=None, description="The category assigned to the campaign. Either pass this parameter OR the `category_id`.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + redemption: Optional[CampaignsVouchersCreateRequestBodyRedemption] = None + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.") + __properties: ClassVar[List[str]] = ["category", "metadata", "redemption", "additional_info", "start_date", "expiration_date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateRequestBody 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 redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "category": obj.get("category"), + "metadata": obj.get("metadata"), + "redemption": CampaignsVouchersCreateRequestBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "additional_info": obj.get("additional_info"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_request_body_redemption.py b/voucherify/models/campaigns_vouchers_create_request_body_redemption.py new file mode 100644 index 00000000..bd5e01f4 --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_request_body_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateRequestBodyRedemption(BaseModel): + """ + Stores the quantity of redemptions that can be applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateRequestBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateRequestBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_response_body.py b/voucherify/models/campaigns_vouchers_create_response_body.py new file mode 100644 index 00000000..7641a2b7 --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_response_body.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaigns_vouchers_create_response_body_gift import CampaignsVouchersCreateResponseBodyGift +from voucherify.models.campaigns_vouchers_create_response_body_loyalty_card import CampaignsVouchersCreateResponseBodyLoyaltyCard +from voucherify.models.campaigns_vouchers_create_response_body_publish import CampaignsVouchersCreateResponseBodyPublish +from voucherify.models.campaigns_vouchers_create_response_body_redemption import CampaignsVouchersCreateResponseBodyRedemption +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/campaigns/{campaignId}/vouchers/{code}` and **POST** `v1/campaigns/{campaignId}/vouchers`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[CampaignsVouchersCreateResponseBodyGift] = None + loyalty_card: Optional[CampaignsVouchersCreateResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[CampaignsVouchersCreateResponseBodyPublish] = None + redemption: Optional[CampaignsVouchersCreateResponseBodyRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBody 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": CampaignsVouchersCreateResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": CampaignsVouchersCreateResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": CampaignsVouchersCreateResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": CampaignsVouchersCreateResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_response_body_gift.py b/voucherify/models/campaigns_vouchers_create_response_body_gift.py new file mode 100644 index 00000000..8d83ae63 --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_response_body_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class CampaignsVouchersCreateResponseBodyGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_response_body_loyalty_card.py b/voucherify/models/campaigns_vouchers_create_response_body_loyalty_card.py new file mode 100644 index 00000000..692208f4 --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_response_body_publish.py b/voucherify/models/campaigns_vouchers_create_response_body_publish.py new file mode 100644 index 00000000..9471bddb --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateResponseBodyPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/campaigns_vouchers_create_response_body_redemption.py b/voucherify/models/campaigns_vouchers_create_response_body_redemption.py new file mode 100644 index 00000000..f4fb1a1a --- /dev/null +++ b/voucherify/models/campaigns_vouchers_create_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CampaignsVouchersCreateResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CampaignsVouchersCreateResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/categories_create_request_body.py b/voucherify/models/categories_create_request_body.py new file mode 100644 index 00000000..cfe485b3 --- /dev/null +++ b/voucherify/models/categories_create_request_body.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CategoriesCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/categories`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Category name.") + hierarchy: Optional[StrictInt] = Field(default=None, description="Category hierarchy.") + __properties: ClassVar[List[str]] = ["name", "hierarchy"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CategoriesCreateRequestBody 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, + ) + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CategoriesCreateRequestBody 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"), + "hierarchy": obj.get("hierarchy") + }) + return _obj + + diff --git a/voucherify/models/categories_create_response_body.py b/voucherify/models/categories_create_response_body.py new file mode 100644 index 00000000..dd7f5663 --- /dev/null +++ b/voucherify/models/categories_create_response_body.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class CategoriesCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/categories`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Category name.") + hierarchy: Optional[StrictInt] = Field(default=None, description="Category hierarchy.") + object: Optional[StrictStr] = 'category' + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format.") + __properties: ClassVar[List[str]] = ["id", "name", "hierarchy", "object", "created_at"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['category']): + raise ValueError("must be one of enum values ('category')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CategoriesCreateResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CategoriesCreateResponseBody 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"), + "name": obj.get("name"), + "hierarchy": obj.get("hierarchy"), + "object": obj.get("object") if obj.get("object") is not None else 'category', + "created_at": obj.get("created_at") + }) + return _obj + + diff --git a/voucherify/models/categories_get_response_body.py b/voucherify/models/categories_get_response_body.py new file mode 100644 index 00000000..2e197db7 --- /dev/null +++ b/voucherify/models/categories_get_response_body.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class CategoriesGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/categories/{categoryId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Category name.") + hierarchy: Optional[StrictInt] = Field(default=None, description="Category hierarchy.") + object: Optional[StrictStr] = Field(default='category', description="The type of the object represented by the JSON. This object stores information about the category.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format.") + stacking_rules_type: Optional[StrictStr] = Field(default=None, description="The type of the stacking rule eligibility.") + __properties: ClassVar[List[str]] = ["id", "name", "hierarchy", "object", "created_at", "updated_at", "stacking_rules_type"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['category']): + raise ValueError("must be one of enum values ('category')") + return value + + @field_validator('stacking_rules_type') + def stacking_rules_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['JOINT', 'EXCLUSIVE']): + raise ValueError("must be one of enum values ('JOINT', 'EXCLUSIVE')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CategoriesGetResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if stacking_rules_type (nullable) is None + # and model_fields_set contains the field + if self.stacking_rules_type is None and "stacking_rules_type" in self.model_fields_set: + _dict['stacking_rules_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CategoriesGetResponseBody 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"), + "name": obj.get("name"), + "hierarchy": obj.get("hierarchy"), + "object": obj.get("object") if obj.get("object") is not None else 'category', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "stacking_rules_type": obj.get("stacking_rules_type") + }) + return _obj + + diff --git a/voucherify/models/categories_list_response_body.py b/voucherify/models/categories_list_response_body.py new file mode 100644 index 00000000..44163012 --- /dev/null +++ b/voucherify/models/categories_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.category import Category +from typing import Optional, Set +from typing_extensions import Self + +class CategoriesListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/categories`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about categories in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of category objects.") + data: Optional[List[Category]] = None + total: Optional[StrictInt] = Field(default=None, description="Total number of categories.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CategoriesListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CategoriesListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [Category.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/categories_update_request_body.py b/voucherify/models/categories_update_request_body.py new file mode 100644 index 00000000..d8bc9f88 --- /dev/null +++ b/voucherify/models/categories_update_request_body.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CategoriesUpdateRequestBody(BaseModel): + """ + Request body schema for **PUT** `v1/categories/{categoryId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Category name.") + hierarchy: Optional[StrictInt] = Field(default=None, description="Category hierarchy.") + __properties: ClassVar[List[str]] = ["name", "hierarchy"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CategoriesUpdateRequestBody 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, + ) + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CategoriesUpdateRequestBody 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"), + "hierarchy": obj.get("hierarchy") + }) + return _obj + + diff --git a/voucherify/models/categories_update_response_body.py b/voucherify/models/categories_update_response_body.py new file mode 100644 index 00000000..fdddec7a --- /dev/null +++ b/voucherify/models/categories_update_response_body.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class CategoriesUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/categories/{categoryId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Category name.") + hierarchy: Optional[StrictInt] = Field(default=None, description="Category hierarchy.") + object: Optional[StrictStr] = 'category' + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format.") + __properties: ClassVar[List[str]] = ["id", "name", "hierarchy", "object", "created_at", "updated_at"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['category']): + raise ValueError("must be one of enum values ('category')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CategoriesUpdateResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CategoriesUpdateResponseBody 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"), + "name": obj.get("name"), + "hierarchy": obj.get("hierarchy"), + "object": obj.get("object") if obj.get("object") is not None else 'category', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at") + }) + return _obj + + diff --git a/voucherify/models/category.py b/voucherify/models/category.py new file mode 100644 index 00000000..92a22d20 --- /dev/null +++ b/voucherify/models/category.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class Category(BaseModel): + """ + This is an object representing a category. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Category name.") + hierarchy: Optional[StrictInt] = Field(default=None, description="Category hierarchy.") + object: Optional[StrictStr] = Field(default='category', description="The type of the object represented by the JSON. This object stores information about the category.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the category was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the category was updated. The value is shown in the ISO 8601 format.") + stacking_rules_type: Optional[StrictStr] = Field(default=None, description="The type of the stacking rule eligibility.") + __properties: ClassVar[List[str]] = ["id", "name", "hierarchy", "object", "created_at", "updated_at", "stacking_rules_type"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['category']): + raise ValueError("must be one of enum values ('category')") + return value + + @field_validator('stacking_rules_type') + def stacking_rules_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['JOINT', 'EXCLUSIVE']): + raise ValueError("must be one of enum values ('JOINT', 'EXCLUSIVE')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Category 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if stacking_rules_type (nullable) is None + # and model_fields_set contains the field + if self.stacking_rules_type is None and "stacking_rules_type" in self.model_fields_set: + _dict['stacking_rules_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Category 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"), + "name": obj.get("name"), + "hierarchy": obj.get("hierarchy"), + "object": obj.get("object") if obj.get("object") is not None else 'category', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "stacking_rules_type": obj.get("stacking_rules_type") + }) + return _obj + + diff --git a/voucherify/models/client_events_create_request_body.py b/voucherify/models/client_events_create_request_body.py new file mode 100644 index 00000000..9757e30c --- /dev/null +++ b/voucherify/models/client_events_create_request_body.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.client_events_create_request_body_loyalty import ClientEventsCreateRequestBodyLoyalty +from voucherify.models.client_events_create_request_body_referral import ClientEventsCreateRequestBodyReferral +from voucherify.models.customer import Customer +from typing import Optional, Set +from typing_extensions import Self + +class ClientEventsCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/events`. + """ # noqa: E501 + event: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = Field(default=None, description="Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**.") + customer: Customer + referral: Optional[ClientEventsCreateRequestBodyReferral] = None + loyalty: Optional[ClientEventsCreateRequestBodyLoyalty] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**.") + __properties: ClassVar[List[str]] = ["event", "customer", "referral", "loyalty", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientEventsCreateRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referral + if self.referral: + _dict['referral'] = self.referral.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if event (nullable) is None + # and model_fields_set contains the field + if self.event is None and "event" in self.model_fields_set: + _dict['event'] = None + + # set to None if referral (nullable) is None + # and model_fields_set contains the field + if self.referral is None and "referral" in self.model_fields_set: + _dict['referral'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientEventsCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "event": obj.get("event"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referral": ClientEventsCreateRequestBodyReferral.from_dict(obj["referral"]) if obj.get("referral") is not None else None, + "loyalty": ClientEventsCreateRequestBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/client_events_create_request_body_loyalty.py b/voucherify/models/client_events_create_request_body_loyalty.py new file mode 100644 index 00000000..27e3ff75 --- /dev/null +++ b/voucherify/models/client_events_create_request_body_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientEventsCreateRequestBodyLoyalty(BaseModel): + """ + If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to. + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code.") + __properties: ClassVar[List[str]] = ["code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientEventsCreateRequestBodyLoyalty 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, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientEventsCreateRequestBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code") + }) + return _obj + + diff --git a/voucherify/models/client_events_create_request_body_referral.py b/voucherify/models/client_events_create_request_body_referral.py new file mode 100644 index 00000000..d0135fb0 --- /dev/null +++ b/voucherify/models/client_events_create_request_body_referral.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientEventsCreateRequestBodyReferral(BaseModel): + """ + If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="A code through which a new visitor has been referred to a service.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique ID of the referring person - it is optional and not required if the referral **code** is provided.") + __properties: ClassVar[List[str]] = ["code", "referrer_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientEventsCreateRequestBodyReferral 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, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientEventsCreateRequestBodyReferral from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "referrer_id": obj.get("referrer_id") + }) + return _obj + + diff --git a/voucherify/models/client_events_create_response_body.py b/voucherify/models/client_events_create_response_body.py new file mode 100644 index 00000000..74e5367a --- /dev/null +++ b/voucherify/models/client_events_create_response_body.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.simple_customer_required_object_type import SimpleCustomerRequiredObjectType +from typing import Optional, Set +from typing_extensions import Self + +class ClientEventsCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/events`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='event', description="The object represented is an `event`.") + type: Optional[StrictStr] = Field(default=None, description="The event name.") + customer: SimpleCustomerRequiredObjectType + referral: Optional[Dict[str, Any]] = Field(default=None, description="A `null` referral object.") + loyalty: Optional[Dict[str, Any]] = Field(default=None, description="A `null` loyalty object.") + metadata: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["object", "type", "customer", "referral", "loyalty", "metadata"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['event']): + raise ValueError("must be one of enum values ('event')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientEventsCreateResponseBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if referral (nullable) is None + # and model_fields_set contains the field + if self.referral is None and "referral" in self.model_fields_set: + _dict['referral'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientEventsCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'event', + "type": obj.get("type"), + "customer": SimpleCustomerRequiredObjectType.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referral": obj.get("referral"), + "loyalty": obj.get("loyalty"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/client_promotions_tiers_list_response_body.py b/voucherify/models/client_promotions_tiers_list_response_body.py new file mode 100644 index 00000000..d548aae4 --- /dev/null +++ b/voucherify/models/client_promotions_tiers_list_response_body.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_tier import PromotionTier +from typing import Optional, Set +from typing_extensions import Self + +class ClientPromotionsTiersListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/client/v1/promotions/tiers`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='tiers', description="Identifies the name of the attribute that contains the array of promotion tier objects.") + tiers: Optional[List[PromotionTier]] = Field(default=None, description="Contains array of promotion tier objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of promotion tiers.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "tiers", "total", "has_more"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientPromotionsTiersListResponseBody 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 tiers (list) + _items = [] + if self.tiers: + for _item_tiers in self.tiers: + if _item_tiers: + _items.append(_item_tiers.to_dict()) + _dict['tiers'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientPromotionsTiersListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'tiers', + "tiers": [PromotionTier.from_dict(_item) for _item in obj["tiers"]] if obj.get("tiers") is not None else None, + "total": obj.get("total"), + "has_more": obj.get("has_more") + }) + return _obj + + diff --git a/voucherify/models/client_qualifications_check_eligibility_request_body.py b/voucherify/models/client_qualifications_check_eligibility_request_body.py new file mode 100644 index 00000000..3086335f --- /dev/null +++ b/voucherify/models/client_qualifications_check_eligibility_request_body.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer import Customer +from voucherify.models.order import Order +from voucherify.models.qualifications_option import QualificationsOption +from typing import Optional, Set +from typing_extensions import Self + +class ClientQualificationsCheckEligibilityRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/qualifications`. + """ # noqa: E501 + customer: Optional[Customer] = None + order: Optional[Order] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Is correspondent to Customer's source_id") + scenario: Optional[StrictStr] = Field(default=None, description="Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s).") + options: Optional[QualificationsOption] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Advanced_ → _Redemption metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).") + __properties: ClassVar[List[str]] = ["customer", "order", "tracking_id", "scenario", "options", "metadata"] + + @field_validator('scenario') + def scenario_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ALL', 'CUSTOMER_WALLET', 'AUDIENCE_ONLY', 'PRODUCTS', 'PRODUCTS_DISCOUNT', 'PROMOTION_STACKS', 'PRODUCTS_BY_CUSTOMER', 'PRODUCTS_DISCOUNT_BY_CUSTOMER']): + raise ValueError("must be one of enum values ('ALL', 'CUSTOMER_WALLET', 'AUDIENCE_ONLY', 'PRODUCTS', 'PRODUCTS_DISCOUNT', 'PROMOTION_STACKS', 'PRODUCTS_BY_CUSTOMER', 'PRODUCTS_DISCOUNT_BY_CUSTOMER')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientQualificationsCheckEligibilityRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of options + if self.options: + _dict['options'] = self.options.to_dict() + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if scenario (nullable) is None + # and model_fields_set contains the field + if self.scenario is None and "scenario" in self.model_fields_set: + _dict['scenario'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientQualificationsCheckEligibilityRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "tracking_id": obj.get("tracking_id"), + "scenario": obj.get("scenario"), + "options": QualificationsOption.from_dict(obj["options"]) if obj.get("options") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/client_qualifications_check_eligibility_response_body.py b/voucherify/models/client_qualifications_check_eligibility_response_body.py new file mode 100644 index 00000000..1de3a6ce --- /dev/null +++ b/voucherify/models/client_qualifications_check_eligibility_response_body.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.qualifications_redeemables import QualificationsRedeemables +from voucherify.models.stacking_rules import StackingRules +from typing import Optional, Set +from typing_extensions import Self + +class ClientQualificationsCheckEligibilityResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/qualifications`. + """ # noqa: E501 + redeemables: Optional[QualificationsRedeemables] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID.") + order: Optional[OrderCalculated] = None + stacking_rules: Optional[StackingRules] = None + __properties: ClassVar[List[str]] = ["redeemables", "tracking_id", "order", "stacking_rules"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientQualificationsCheckEligibilityResponseBody 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 redeemables + if self.redeemables: + _dict['redeemables'] = self.redeemables.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of stacking_rules + if self.stacking_rules: + _dict['stacking_rules'] = self.stacking_rules.to_dict() + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientQualificationsCheckEligibilityResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redeemables": QualificationsRedeemables.from_dict(obj["redeemables"]) if obj.get("redeemables") is not None else None, + "tracking_id": obj.get("tracking_id"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "stacking_rules": StackingRules.from_dict(obj["stacking_rules"]) if obj.get("stacking_rules") is not None else None + }) + return _obj + + diff --git a/voucherify/models/client_redemptions_redeem_request_body.py b/voucherify/models/client_redemptions_redeem_request_body.py new file mode 100644 index 00000000..9a5b3a8a --- /dev/null +++ b/voucherify/models/client_redemptions_redeem_request_body.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.client_redemptions_redeem_request_body_options import ClientRedemptionsRedeemRequestBodyOptions +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item import ClientRedemptionsRedeemRequestBodyRedeemablesItem +from voucherify.models.customer import Customer +from voucherify.models.order import Order +from voucherify.models.session import Session +from typing import Optional, Set +from typing_extensions import Self + +class ClientRedemptionsRedeemRequestBody(BaseModel): + """ + Response body schema for **POST** `v1/redemptions`. + """ # noqa: E501 + options: Optional[ClientRedemptionsRedeemRequestBodyOptions] = None + redeemables: Optional[List[ClientRedemptionsRedeemRequestBodyRedeemablesItem]] = None + order: Optional[Order] = None + customer: Optional[Customer] = None + session: Optional[Session] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Is correspondent to Customer's source_id") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format.") + __properties: ClassVar[List[str]] = ["options", "redeemables", "order", "customer", "session", "tracking_id", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBody 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 options + if self.options: + _dict['options'] = self.options.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in redeemables (list) + _items = [] + if self.redeemables: + for _item_redeemables in self.redeemables: + if _item_redeemables: + _items.append(_item_redeemables.to_dict()) + _dict['redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of session + if self.session: + _dict['session'] = self.session.to_dict() + # set to None if options (nullable) is None + # and model_fields_set contains the field + if self.options is None and "options" in self.model_fields_set: + _dict['options'] = None + + # set to None if redeemables (nullable) is None + # and model_fields_set contains the field + if self.redeemables is None and "redeemables" in self.model_fields_set: + _dict['redeemables'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "options": ClientRedemptionsRedeemRequestBodyOptions.from_dict(obj["options"]) if obj.get("options") is not None else None, + "redeemables": [ClientRedemptionsRedeemRequestBodyRedeemablesItem.from_dict(_item) for _item in obj["redeemables"]] if obj.get("redeemables") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "session": Session.from_dict(obj["session"]) if obj.get("session") is not None else None, + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/client_redemptions_redeem_request_body_options.py b/voucherify/models/client_redemptions_redeem_request_body_options.py new file mode 100644 index 00000000..aae43670 --- /dev/null +++ b/voucherify/models/client_redemptions_redeem_request_body_options.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ClientRedemptionsRedeemRequestBodyOptions(BaseModel): + """ + Configure parameters returned in the response. + """ # noqa: E501 + expand: Optional[List[StrictStr]] = Field(default=None, description="Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |") + __properties: ClassVar[List[str]] = ["expand"] + + @field_validator('expand') + def expand_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['order', 'redemption', 'redeemable', 'category']): + raise ValueError("each list item must be one of ('order', 'redemption', 'redeemable', 'category')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyOptions 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, + ) + # set to None if expand (nullable) is None + # and model_fields_set contains the field + if self.expand is None and "expand" in self.model_fields_set: + _dict['expand'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expand": obj.get("expand") + }) + return _obj + + diff --git a/voucherify/models/client_redemptions_redeem_request_body_redeemables_item.py b/voucherify/models/client_redemptions_redeem_request_body_redeemables_item.py new file mode 100644 index 00000000..6a421159 --- /dev/null +++ b/voucherify/models/client_redemptions_redeem_request_body_redeemables_item.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item_gift import ClientRedemptionsRedeemRequestBodyRedeemablesItemGift +from voucherify.models.client_redemptions_redeem_request_body_redeemables_item_reward import ClientRedemptionsRedeemRequestBodyRedeemablesItemReward +from typing import Optional, Set +from typing_extensions import Self + +class ClientRedemptionsRedeemRequestBodyRedeemablesItem(BaseModel): + """ + ClientRedemptionsRedeemRequestBodyRedeemablesItem + """ # noqa: E501 + object: Optional[StrictStr] = None + id: Optional[StrictStr] = None + gift: Optional[ClientRedemptionsRedeemRequestBodyRedeemablesItemGift] = None + reward: Optional[ClientRedemptionsRedeemRequestBodyRedeemablesItemReward] = None + __properties: ClassVar[List[str]] = ["object", "id", "gift", "reward"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'promotion_stack']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyRedeemablesItem 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 gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyRedeemablesItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object"), + "id": obj.get("id"), + "gift": ClientRedemptionsRedeemRequestBodyRedeemablesItemGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "reward": ClientRedemptionsRedeemRequestBodyRedeemablesItemReward.from_dict(obj["reward"]) if obj.get("reward") is not None else None + }) + return _obj + + diff --git a/voucherify/models/client_redemptions_redeem_request_body_redeemables_item_gift.py b/voucherify/models/client_redemptions_redeem_request_body_redeemables_item_gift.py new file mode 100644 index 00000000..a01cc213 --- /dev/null +++ b/voucherify/models/client_redemptions_redeem_request_body_redeemables_item_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientRedemptionsRedeemRequestBodyRedeemablesItemGift(BaseModel): + """ + Contains information on the number of gift card credits that the customer wants to apply to the order. + """ # noqa: E501 + credits: Optional[StrictInt] = Field(default=None, description="The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + __properties: ClassVar[List[str]] = ["credits"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyRedeemablesItemGift 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, + ) + # set to None if credits (nullable) is None + # and model_fields_set contains the field + if self.credits is None and "credits" in self.model_fields_set: + _dict['credits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyRedeemablesItemGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "credits": obj.get("credits") + }) + return _obj + + diff --git a/voucherify/models/client_redemptions_redeem_request_body_redeemables_item_reward.py b/voucherify/models/client_redemptions_redeem_request_body_redeemables_item_reward.py new file mode 100644 index 00000000..fe55ed04 --- /dev/null +++ b/voucherify/models/client_redemptions_redeem_request_body_redeemables_item_reward.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientRedemptionsRedeemRequestBodyRedeemablesItemReward(BaseModel): + """ + Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.") + points: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card.") + __properties: ClassVar[List[str]] = ["id", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyRedeemablesItemReward 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemRequestBodyRedeemablesItemReward 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"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/client_redemptions_redeem_response_body.py b/voucherify/models/client_redemptions_redeem_response_body.py new file mode 100644 index 00000000..e1812e28 --- /dev/null +++ b/voucherify/models/client_redemptions_redeem_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.redemption import Redemption +from voucherify.models.validations_redeemable_inapplicable import ValidationsRedeemableInapplicable +from voucherify.models.validations_redeemable_skipped import ValidationsRedeemableSkipped +from typing import Optional, Set +from typing_extensions import Self + +class ClientRedemptionsRedeemResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/redemptions`. + """ # noqa: E501 + redemptions: Optional[List[Redemption]] = None + parent_redemption: Optional[Redemption] = None + order: Optional[OrderCalculated] = None + inapplicable_redeemables: Optional[List[ValidationsRedeemableInapplicable]] = Field(default=None, description="Lists validation results of each inapplicable redeemable.") + skipped_redeemables: Optional[List[ValidationsRedeemableSkipped]] = Field(default=None, description="Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.") + __properties: ClassVar[List[str]] = ["redemptions", "parent_redemption", "order", "inapplicable_redeemables", "skipped_redeemables"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemResponseBody 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 redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # override the default output from pydantic by calling `to_dict()` of parent_redemption + if self.parent_redemption: + _dict['parent_redemption'] = self.parent_redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in inapplicable_redeemables (list) + _items = [] + if self.inapplicable_redeemables: + for _item_inapplicable_redeemables in self.inapplicable_redeemables: + if _item_inapplicable_redeemables: + _items.append(_item_inapplicable_redeemables.to_dict()) + _dict['inapplicable_redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in skipped_redeemables (list) + _items = [] + if self.skipped_redeemables: + for _item_skipped_redeemables in self.skipped_redeemables: + if _item_skipped_redeemables: + _items.append(_item_skipped_redeemables.to_dict()) + _dict['skipped_redeemables'] = _items + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if inapplicable_redeemables (nullable) is None + # and model_fields_set contains the field + if self.inapplicable_redeemables is None and "inapplicable_redeemables" in self.model_fields_set: + _dict['inapplicable_redeemables'] = None + + # set to None if skipped_redeemables (nullable) is None + # and model_fields_set contains the field + if self.skipped_redeemables is None and "skipped_redeemables" in self.model_fields_set: + _dict['skipped_redeemables'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRedemptionsRedeemResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": [Redemption.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None, + "parent_redemption": Redemption.from_dict(obj["parent_redemption"]) if obj.get("parent_redemption") is not None else None, + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "inapplicable_redeemables": [ValidationsRedeemableInapplicable.from_dict(_item) for _item in obj["inapplicable_redeemables"]] if obj.get("inapplicable_redeemables") is not None else None, + "skipped_redeemables": [ValidationsRedeemableSkipped.from_dict(_item) for _item in obj["skipped_redeemables"]] if obj.get("skipped_redeemables") is not None else None + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_request_body.py b/voucherify/models/client_validations_validate_request_body.py new file mode 100644 index 00000000..52f6ddf1 --- /dev/null +++ b/voucherify/models/client_validations_validate_request_body.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.client_validations_validate_request_body_options import ClientValidationsValidateRequestBodyOptions +from voucherify.models.client_validations_validate_request_body_redeemables_item import ClientValidationsValidateRequestBodyRedeemablesItem +from voucherify.models.customer import Customer +from voucherify.models.order import Order +from voucherify.models.session import Session +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateRequestBody(BaseModel): + """ + Response body schema for **POST** `v1/validations`. + """ # noqa: E501 + options: Optional[ClientValidationsValidateRequestBodyOptions] = None + redeemables: Optional[List[ClientValidationsValidateRequestBodyRedeemablesItem]] = None + order: Optional[Order] = None + customer: Optional[Customer] = None + session: Optional[Session] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Is correspondent to Customer's source_id") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format.") + __properties: ClassVar[List[str]] = ["options", "redeemables", "order", "customer", "session", "tracking_id", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBody 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 options + if self.options: + _dict['options'] = self.options.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in redeemables (list) + _items = [] + if self.redeemables: + for _item_redeemables in self.redeemables: + if _item_redeemables: + _items.append(_item_redeemables.to_dict()) + _dict['redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of session + if self.session: + _dict['session'] = self.session.to_dict() + # set to None if options (nullable) is None + # and model_fields_set contains the field + if self.options is None and "options" in self.model_fields_set: + _dict['options'] = None + + # set to None if redeemables (nullable) is None + # and model_fields_set contains the field + if self.redeemables is None and "redeemables" in self.model_fields_set: + _dict['redeemables'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "options": ClientValidationsValidateRequestBodyOptions.from_dict(obj["options"]) if obj.get("options") is not None else None, + "redeemables": [ClientValidationsValidateRequestBodyRedeemablesItem.from_dict(_item) for _item in obj["redeemables"]] if obj.get("redeemables") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "session": Session.from_dict(obj["session"]) if obj.get("session") is not None else None, + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_request_body_options.py b/voucherify/models/client_validations_validate_request_body_options.py new file mode 100644 index 00000000..d2314d9b --- /dev/null +++ b/voucherify/models/client_validations_validate_request_body_options.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateRequestBodyOptions(BaseModel): + """ + Configure parameters returned in the response. + """ # noqa: E501 + expand: Optional[List[StrictStr]] = Field(default=None, description="The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |") + __properties: ClassVar[List[str]] = ["expand"] + + @field_validator('expand') + def expand_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['order', 'redemption', 'redeemable', 'category']): + raise ValueError("each list item must be one of ('order', 'redemption', 'redeemable', 'category')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyOptions 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, + ) + # set to None if expand (nullable) is None + # and model_fields_set contains the field + if self.expand is None and "expand" in self.model_fields_set: + _dict['expand'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expand": obj.get("expand") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_request_body_redeemables_item.py b/voucherify/models/client_validations_validate_request_body_redeemables_item.py new file mode 100644 index 00000000..3898956c --- /dev/null +++ b/voucherify/models/client_validations_validate_request_body_redeemables_item.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.client_validations_validate_request_body_redeemables_item_gift import ClientValidationsValidateRequestBodyRedeemablesItemGift +from voucherify.models.client_validations_validate_request_body_redeemables_item_reward import ClientValidationsValidateRequestBodyRedeemablesItemReward +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateRequestBodyRedeemablesItem(BaseModel): + """ + ClientValidationsValidateRequestBodyRedeemablesItem + """ # noqa: E501 + object: Optional[StrictStr] = None + id: Optional[StrictStr] = None + gift: Optional[ClientValidationsValidateRequestBodyRedeemablesItemGift] = None + reward: Optional[ClientValidationsValidateRequestBodyRedeemablesItemReward] = None + __properties: ClassVar[List[str]] = ["object", "id", "gift", "reward"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'promotion_stack']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyRedeemablesItem 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 gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyRedeemablesItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object"), + "id": obj.get("id"), + "gift": ClientValidationsValidateRequestBodyRedeemablesItemGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "reward": ClientValidationsValidateRequestBodyRedeemablesItemReward.from_dict(obj["reward"]) if obj.get("reward") is not None else None + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_request_body_redeemables_item_gift.py b/voucherify/models/client_validations_validate_request_body_redeemables_item_gift.py new file mode 100644 index 00000000..6c0f513f --- /dev/null +++ b/voucherify/models/client_validations_validate_request_body_redeemables_item_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateRequestBodyRedeemablesItemGift(BaseModel): + """ + Contains information on the number of gift card credits that the customer wants to apply to the order. + """ # noqa: E501 + credits: Optional[StrictInt] = Field(default=None, description="The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + __properties: ClassVar[List[str]] = ["credits"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyRedeemablesItemGift 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, + ) + # set to None if credits (nullable) is None + # and model_fields_set contains the field + if self.credits is None and "credits" in self.model_fields_set: + _dict['credits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyRedeemablesItemGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "credits": obj.get("credits") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_request_body_redeemables_item_reward.py b/voucherify/models/client_validations_validate_request_body_redeemables_item_reward.py new file mode 100644 index 00000000..745bd274 --- /dev/null +++ b/voucherify/models/client_validations_validate_request_body_redeemables_item_reward.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateRequestBodyRedeemablesItemReward(BaseModel): + """ + Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.") + points: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card.") + __properties: ClassVar[List[str]] = ["id", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyRedeemablesItemReward 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateRequestBodyRedeemablesItemReward 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"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body.py b/voucherify/models/client_validations_validate_response_body.py new file mode 100644 index 00000000..6a542455 --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.client_validations_validate_response_body_redeemables_item import ClientValidationsValidateResponseBodyRedeemablesItem +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.session import Session +from voucherify.models.stacking_rules import StackingRules +from voucherify.models.validations_redeemable_inapplicable import ValidationsRedeemableInapplicable +from voucherify.models.validations_redeemable_skipped import ValidationsRedeemableSkipped +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBody(BaseModel): + """ + Response body schema for POST `/validations`. + """ # noqa: E501 + valid: Optional[StrictBool] = Field(default=None, description="The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.") + redeemables: Optional[List[ClientValidationsValidateResponseBodyRedeemablesItem]] = None + skipped_redeemables: Optional[List[ValidationsRedeemableSkipped]] = Field(default=None, description="Lists validation results of each skipped redeemable.") + inapplicable_redeemables: Optional[List[ValidationsRedeemableInapplicable]] = Field(default=None, description="Lists validation results of each inapplicable redeemable.") + order: Optional[OrderCalculated] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + session: Optional[Session] = None + stacking_rules: StackingRules + __properties: ClassVar[List[str]] = ["valid", "redeemables", "skipped_redeemables", "inapplicable_redeemables", "order", "tracking_id", "session", "stacking_rules"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBody 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 redeemables (list) + _items = [] + if self.redeemables: + for _item_redeemables in self.redeemables: + if _item_redeemables: + _items.append(_item_redeemables.to_dict()) + _dict['redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in skipped_redeemables (list) + _items = [] + if self.skipped_redeemables: + for _item_skipped_redeemables in self.skipped_redeemables: + if _item_skipped_redeemables: + _items.append(_item_skipped_redeemables.to_dict()) + _dict['skipped_redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in inapplicable_redeemables (list) + _items = [] + if self.inapplicable_redeemables: + for _item_inapplicable_redeemables in self.inapplicable_redeemables: + if _item_inapplicable_redeemables: + _items.append(_item_inapplicable_redeemables.to_dict()) + _dict['inapplicable_redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of session + if self.session: + _dict['session'] = self.session.to_dict() + # override the default output from pydantic by calling `to_dict()` of stacking_rules + if self.stacking_rules: + _dict['stacking_rules'] = self.stacking_rules.to_dict() + # set to None if valid (nullable) is None + # and model_fields_set contains the field + if self.valid is None and "valid" in self.model_fields_set: + _dict['valid'] = None + + # set to None if redeemables (nullable) is None + # and model_fields_set contains the field + if self.redeemables is None and "redeemables" in self.model_fields_set: + _dict['redeemables'] = None + + # set to None if skipped_redeemables (nullable) is None + # and model_fields_set contains the field + if self.skipped_redeemables is None and "skipped_redeemables" in self.model_fields_set: + _dict['skipped_redeemables'] = None + + # set to None if inapplicable_redeemables (nullable) is None + # and model_fields_set contains the field + if self.inapplicable_redeemables is None and "inapplicable_redeemables" in self.model_fields_set: + _dict['inapplicable_redeemables'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "valid": obj.get("valid"), + "redeemables": [ClientValidationsValidateResponseBodyRedeemablesItem.from_dict(_item) for _item in obj["redeemables"]] if obj.get("redeemables") is not None else None, + "skipped_redeemables": [ValidationsRedeemableSkipped.from_dict(_item) for _item in obj["skipped_redeemables"]] if obj.get("skipped_redeemables") is not None else None, + "inapplicable_redeemables": [ValidationsRedeemableInapplicable.from_dict(_item) for _item in obj["inapplicable_redeemables"]] if obj.get("inapplicable_redeemables") is not None else None, + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "tracking_id": obj.get("tracking_id"), + "session": Session.from_dict(obj["session"]) if obj.get("session") is not None else None, + "stacking_rules": StackingRules.from_dict(obj["stacking_rules"]) if obj.get("stacking_rules") is not None else None + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body_redeemables_item.py b/voucherify/models/client_validations_validate_response_body_redeemables_item.py new file mode 100644 index 00000000..c02db58a --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body_redeemables_item.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.applicable_to_result_list import ApplicableToResultList +from voucherify.models.category import Category +from voucherify.models.client_validations_validate_response_body_redeemables_item_result import ClientValidationsValidateResponseBodyRedeemablesItemResult +from voucherify.models.inapplicable_to_result_list import InapplicableToResultList +from voucherify.models.order_calculated import OrderCalculated +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBodyRedeemablesItem(BaseModel): + """ + ClientValidationsValidateResponseBodyRedeemablesItem + """ # noqa: E501 + status: Optional[StrictStr] = None + id: Optional[StrictStr] = Field(default=None, description="Redeemable ID, i.e. the voucher code.") + object: Optional[StrictStr] = Field(default=None, description="Redeemable's object type.") + order: Optional[OrderCalculated] = None + applicable_to: Optional[ApplicableToResultList] = None + inapplicable_to: Optional[InapplicableToResultList] = None + result: Optional[ClientValidationsValidateResponseBodyRedeemablesItemResult] = None + metadata: Optional[Dict[str, Any]] = None + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["status", "id", "object", "order", "applicable_to", "inapplicable_to", "result", "metadata", "categories"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLICABLE', 'INAPPLICABLE', 'SKIPPED']): + raise ValueError("must be one of enum values ('APPLICABLE', 'INAPPLICABLE', 'SKIPPED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItem 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of inapplicable_to + if self.inapplicable_to: + _dict['inapplicable_to'] = self.inapplicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status"), + "id": obj.get("id"), + "object": obj.get("object"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "applicable_to": ApplicableToResultList.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "inapplicable_to": InapplicableToResultList.from_dict(obj["inapplicable_to"]) if obj.get("inapplicable_to") is not None else None, + "result": ClientValidationsValidateResponseBodyRedeemablesItemResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "metadata": obj.get("metadata"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body_redeemables_item_result.py b/voucherify/models/client_validations_validate_response_body_redeemables_item_result.py new file mode 100644 index 00000000..c9f3c504 --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body_redeemables_item_result.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_details import ClientValidationsValidateResponseBodyRedeemablesItemResultDetails +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_discount import ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_gift import ClientValidationsValidateResponseBodyRedeemablesItemResultGift +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_loyalty_card import ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard +from voucherify.models.error import Error +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBodyRedeemablesItemResult(BaseModel): + """ + ClientValidationsValidateResponseBodyRedeemablesItemResult + """ # noqa: E501 + discount: Optional[ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount] = None + gift: Optional[ClientValidationsValidateResponseBodyRedeemablesItemResultGift] = None + loyalty_card: Optional[ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard] = None + error: Optional[Error] = None + details: Optional[ClientValidationsValidateResponseBodyRedeemablesItemResultDetails] = None + __properties: ClassVar[List[str]] = ["discount", "gift", "loyalty_card", "error", "details"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResult 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of details + if self.details: + _dict['details'] = self.details.to_dict() + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": ClientValidationsValidateResponseBodyRedeemablesItemResultGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "error": Error.from_dict(obj["error"]) if obj.get("error") is not None else None, + "details": ClientValidationsValidateResponseBodyRedeemablesItemResultDetails.from_dict(obj["details"]) if obj.get("details") is not None else None + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body_redeemables_item_result_details.py b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_details.py new file mode 100644 index 00000000..0ec36143 --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_details.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBodyRedeemablesItemResultDetails(BaseModel): + """ + ClientValidationsValidateResponseBodyRedeemablesItemResultDetails + """ # noqa: E501 + key: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["key", "message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultDetails 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 ClientValidationsValidateResponseBodyRedeemablesItemResultDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body_redeemables_item_result_discount.py b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_discount.py new file mode 100644 index 00000000..e9c9aec9 --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_discount.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from voucherify.models.client_validations_validate_response_body_redeemables_item_result_discount_product import ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct +from voucherify.models.discount_unit_multiple_one_unit import DiscountUnitMultipleOneUnit +from voucherify.models.simple_sku_discount_unit import SimpleSkuDiscountUnit +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount(BaseModel): + """ + ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount + """ # noqa: E501 + type: Optional[StrictStr] = None + amount_off: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000.") + amount_off_formula: Optional[StrictStr] = None + aggregated_amount_limit: Optional[StrictInt] = Field(default=None, description="Maximum discount amount per order.") + effect: Optional[StrictStr] = None + is_dynamic: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the discount was calculated using a formula.") + unit_off: Optional[StrictInt] = Field(default=None, description="Number of units to be granted a full value discount.") + unit_off_formula: Optional[StrictStr] = None + unit_type: Optional[StrictStr] = Field(default=None, description="The product deemed as free, chosen from product inventory (e.g. time, items).") + product: Optional[ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct] = None + sku: Optional[SimpleSkuDiscountUnit] = None + units: Optional[List[DiscountUnitMultipleOneUnit]] = None + percent_off: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The percent discount that the customer will receive.") + percent_off_formula: Optional[StrictStr] = None + amount_limit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.") + fixed_amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value.") + fixed_amount_formula: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type", "amount_off", "amount_off_formula", "aggregated_amount_limit", "effect", "is_dynamic", "unit_off", "unit_off_formula", "unit_type", "product", "sku", "units", "percent_off", "percent_off_formula", "amount_limit", "fixed_amount", "fixed_amount_formula"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AMOUNT', 'UNIT', 'PERCENT', 'FIXED']): + raise ValueError("must be one of enum values ('AMOUNT', 'UNIT', 'PERCENT', 'FIXED')") + return value + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS', 'APPLY_TO_ITEMS_PROPORTIONALLY', 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY', 'APPLY_TO_ITEMS_BY_QUANTITY', 'ADD_MISSING_ITEMS', 'ADD_NEW_ITEMS', 'ADD_MANY_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS', 'APPLY_TO_ITEMS_PROPORTIONALLY', 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY', 'APPLY_TO_ITEMS_BY_QUANTITY', 'ADD_MISSING_ITEMS', 'ADD_NEW_ITEMS', 'ADD_MANY_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount 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 product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of sku + if self.sku: + _dict['sku'] = self.sku.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in units (list) + _items = [] + if self.units: + for _item_units in self.units: + if _item_units: + _items.append(_item_units.to_dict()) + _dict['units'] = _items + # set to None if amount_off (nullable) is None + # and model_fields_set contains the field + if self.amount_off is None and "amount_off" in self.model_fields_set: + _dict['amount_off'] = None + + # set to None if amount_off_formula (nullable) is None + # and model_fields_set contains the field + if self.amount_off_formula is None and "amount_off_formula" in self.model_fields_set: + _dict['amount_off_formula'] = None + + # set to None if aggregated_amount_limit (nullable) is None + # and model_fields_set contains the field + if self.aggregated_amount_limit is None and "aggregated_amount_limit" in self.model_fields_set: + _dict['aggregated_amount_limit'] = None + + # set to None if is_dynamic (nullable) is None + # and model_fields_set contains the field + if self.is_dynamic is None and "is_dynamic" in self.model_fields_set: + _dict['is_dynamic'] = None + + # set to None if unit_off (nullable) is None + # and model_fields_set contains the field + if self.unit_off is None and "unit_off" in self.model_fields_set: + _dict['unit_off'] = None + + # set to None if unit_off_formula (nullable) is None + # and model_fields_set contains the field + if self.unit_off_formula is None and "unit_off_formula" in self.model_fields_set: + _dict['unit_off_formula'] = None + + # set to None if unit_type (nullable) is None + # and model_fields_set contains the field + if self.unit_type is None and "unit_type" in self.model_fields_set: + _dict['unit_type'] = None + + # set to None if units (nullable) is None + # and model_fields_set contains the field + if self.units is None and "units" in self.model_fields_set: + _dict['units'] = None + + # set to None if percent_off (nullable) is None + # and model_fields_set contains the field + if self.percent_off is None and "percent_off" in self.model_fields_set: + _dict['percent_off'] = None + + # set to None if percent_off_formula (nullable) is None + # and model_fields_set contains the field + if self.percent_off_formula is None and "percent_off_formula" in self.model_fields_set: + _dict['percent_off_formula'] = None + + # set to None if amount_limit (nullable) is None + # and model_fields_set contains the field + if self.amount_limit is None and "amount_limit" in self.model_fields_set: + _dict['amount_limit'] = None + + # set to None if fixed_amount (nullable) is None + # and model_fields_set contains the field + if self.fixed_amount is None and "fixed_amount" in self.model_fields_set: + _dict['fixed_amount'] = None + + # set to None if fixed_amount_formula (nullable) is None + # and model_fields_set contains the field + if self.fixed_amount_formula is None and "fixed_amount_formula" in self.model_fields_set: + _dict['fixed_amount_formula'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "amount_off": obj.get("amount_off"), + "amount_off_formula": obj.get("amount_off_formula"), + "aggregated_amount_limit": obj.get("aggregated_amount_limit"), + "effect": obj.get("effect"), + "is_dynamic": obj.get("is_dynamic"), + "unit_off": obj.get("unit_off"), + "unit_off_formula": obj.get("unit_off_formula"), + "unit_type": obj.get("unit_type"), + "product": ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sku": SimpleSkuDiscountUnit.from_dict(obj["sku"]) if obj.get("sku") is not None else None, + "units": [DiscountUnitMultipleOneUnit.from_dict(_item) for _item in obj["units"]] if obj.get("units") is not None else None, + "percent_off": obj.get("percent_off"), + "percent_off_formula": obj.get("percent_off_formula"), + "amount_limit": obj.get("amount_limit"), + "fixed_amount": obj.get("fixed_amount"), + "fixed_amount_formula": obj.get("fixed_amount_formula") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body_redeemables_item_result_discount_product.py b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_discount_product.py new file mode 100644 index 00000000..3ae640f5 --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_discount_product.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct(BaseModel): + """ + ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID, assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Product's source ID.") + name: Optional[StrictStr] = Field(default=None, description="Product name.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body_redeemables_item_result_gift.py b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_gift.py new file mode 100644 index 00000000..538011b7 --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBodyRedeemablesItemResultGift(BaseModel): + """ + Stores the amount of gift card credits to be applied in the redemption. + """ # noqa: E501 + credits: Optional[StrictInt] = Field(default=None, description="Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["credits"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultGift 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, + ) + # set to None if credits (nullable) is None + # and model_fields_set contains the field + if self.credits is None and "credits" in self.model_fields_set: + _dict['credits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "credits": obj.get("credits") + }) + return _obj + + diff --git a/voucherify/models/client_validations_validate_response_body_redeemables_item_result_loyalty_card.py b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_loyalty_card.py new file mode 100644 index 00000000..509092a9 --- /dev/null +++ b/voucherify/models/client_validations_validate_response_body_redeemables_item_result_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard(BaseModel): + """ + ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total number of loyalty points to be applied in the redemption.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/code_config.py b/voucherify/models/code_config.py new file mode 100644 index 00000000..79117c7d --- /dev/null +++ b/voucherify/models/code_config.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class CodeConfig(BaseModel): + """ + Contains information about the config used for the voucher code. Defines the code's pattern (prefix, postfix, length, charset, etc). + """ # noqa: E501 + length: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number of characters in a generated code (excluding prefix and postfix).") + charset: Optional[StrictStr] = Field(default=None, description="Characters that can appear in the code. Examples: - Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` - Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` - Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` - Numbers: `0123456789` - Custom: a custom character set") + prefix: Optional[StrictStr] = Field(default=None, description="A text appended before the code.") + postfix: Optional[StrictStr] = Field(default=None, description="A text appended after the code.") + pattern: Optional[StrictStr] = Field(default=None, description="A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`.") + initial_count: Optional[StrictInt] = Field(default=None, description="Internal value, does not change anything if provided.") + __properties: ClassVar[List[str]] = ["length", "charset", "prefix", "postfix", "pattern", "initial_count"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CodeConfig 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, + ) + # set to None if length (nullable) is None + # and model_fields_set contains the field + if self.length is None and "length" in self.model_fields_set: + _dict['length'] = None + + # set to None if charset (nullable) is None + # and model_fields_set contains the field + if self.charset is None and "charset" in self.model_fields_set: + _dict['charset'] = None + + # set to None if prefix (nullable) is None + # and model_fields_set contains the field + if self.prefix is None and "prefix" in self.model_fields_set: + _dict['prefix'] = None + + # set to None if postfix (nullable) is None + # and model_fields_set contains the field + if self.postfix is None and "postfix" in self.model_fields_set: + _dict['postfix'] = None + + # set to None if pattern (nullable) is None + # and model_fields_set contains the field + if self.pattern is None and "pattern" in self.model_fields_set: + _dict['pattern'] = None + + # set to None if initial_count (nullable) is None + # and model_fields_set contains the field + if self.initial_count is None and "initial_count" in self.model_fields_set: + _dict['initial_count'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CodeConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "length": obj.get("length"), + "charset": obj.get("charset"), + "prefix": obj.get("prefix"), + "postfix": obj.get("postfix"), + "pattern": obj.get("pattern"), + "initial_count": obj.get("initial_count") + }) + return _obj + + diff --git a/voucherify/models/create_publication_campaign.py b/voucherify/models/create_publication_campaign.py new file mode 100644 index 00000000..7cf84417 --- /dev/null +++ b/voucherify/models/create_publication_campaign.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class CreatePublicationCampaign(BaseModel): + """ + Create publication with campaign. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify.") + count: Optional[Annotated[int, Field(le=20, strict=True, ge=1)]] = Field(default=None, description="Number of vouchers to be published to customer.") + __properties: ClassVar[List[str]] = ["name", "count"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreatePublicationCampaign 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, + ) + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreatePublicationCampaign 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"), + "count": obj.get("count") + }) + return _obj + + diff --git a/voucherify/models/customer.py b/voucherify/models/customer.py new file mode 100644 index 00000000..d37d9ffb --- /dev/null +++ b/voucherify/models/customer.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_address import CustomerAddress +from typing import Optional, Set +from typing_extensions import Self + +class Customer(BaseModel): + """ + Customer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomerAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Customer 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 address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Customer 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customer_activity.py b/voucherify/models/customer_activity.py new file mode 100644 index 00000000..9065db8c --- /dev/null +++ b/voucherify/models/customer_activity.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerActivity(BaseModel): + """ + This is an object representing customer activity. This is a general object which presents moments from customers' activity. There are all types of different events that customers perform during their journey once they participate in Promotions. Events describe moments when customers redeem coupons and earn points or rewards. The list of all types of activities is listed below. The details describing the activity are collected in a property named `data`. In this object, software integrators will find all further information explaining the event context. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique event ID, assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Event type.") + data: Optional[Dict[str, Any]] = Field(default=None, description="Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer activity occurred in ISO 8601 format.") + group_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the request that caused the event.") + __properties: ClassVar[List[str]] = ["id", "type", "data", "created_at", "group_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerActivity 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if group_id (nullable) is None + # and model_fields_set contains the field + if self.group_id is None and "group_id" in self.model_fields_set: + _dict['group_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerActivity 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"), + "type": obj.get("type"), + "data": obj.get("data"), + "created_at": obj.get("created_at"), + "group_id": obj.get("group_id") + }) + return _obj + + diff --git a/voucherify/models/customer_address.py b/voucherify/models/customer_address.py new file mode 100644 index 00000000..4f624327 --- /dev/null +++ b/voucherify/models/customer_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customer_id.py b/voucherify/models/customer_id.py new file mode 100644 index 00000000..2d6f0c62 --- /dev/null +++ b/voucherify/models/customer_id.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class CustomerId(BaseModel): + """ + CustomerId + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerId 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerId 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/customer_loyalty.py b/voucherify/models/customer_loyalty.py new file mode 100644 index 00000000..5f36c067 --- /dev/null +++ b/voucherify/models/customer_loyalty.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerLoyalty(BaseModel): + """ + CustomerLoyalty + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Customer's loyalty points.") + referred_customers: Optional[StrictInt] = Field(default=None, description="Total number of customers referred by the customer.") + campaigns: Optional[Dict[str, Any]] = Field(default=None, description="Contains campaigns with details about point balances and how many customers were referred by the customer.") + __properties: ClassVar[List[str]] = ["points", "referred_customers", "campaigns"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if referred_customers (nullable) is None + # and model_fields_set contains the field + if self.referred_customers is None and "referred_customers" in self.model_fields_set: + _dict['referred_customers'] = None + + # set to None if campaigns (nullable) is None + # and model_fields_set contains the field + if self.campaigns is None and "campaigns" in self.model_fields_set: + _dict['campaigns'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "referred_customers": obj.get("referred_customers"), + "campaigns": obj.get("campaigns") + }) + return _obj + + diff --git a/voucherify/models/customer_redeemable.py b/voucherify/models/customer_redeemable.py new file mode 100644 index 00000000..9e8636d8 --- /dev/null +++ b/voucherify/models/customer_redeemable.py @@ -0,0 +1,191 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_redeemable_redeemable import CustomerRedeemableRedeemable +from typing import Optional, Set +from typing_extensions import Self + +class CustomerRedeemable(BaseModel): + """ + Single customer's redeemable + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redeemable holder identifier.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the redeemable was assigned. The value is shown in the ISO 8601 format.") + redeemable_id: Optional[StrictStr] = Field(default=None, description="Identifier of the redeemable item.") + redeemable_object: Optional[StrictStr] = Field(default=None, description="Type of the redeemable.") + customer_id: Optional[StrictStr] = Field(default=None, description="Identifier of the customer.") + holder_role: Optional[StrictStr] = Field(default='OWNER', description="Role of the holder.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Unique campaign identifier, assigned by Voucherify.") + campaign_type: Optional[StrictStr] = Field(default='DISCOUNT_COUPONS', description="Defines the type of the campaign.") + voucher_type: Optional[StrictStr] = Field(default='DISCOUNT_VOUCHER', description="Defines the type of the voucher.") + redeemable: Optional[CustomerRedeemableRedeemable] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "redeemable_id", "redeemable_object", "customer_id", "holder_role", "campaign_id", "campaign_type", "voucher_type", "redeemable"] + + @field_validator('holder_role') + def holder_role_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['OWNER', 'REFERRER', 'REFEREE']): + raise ValueError("must be one of enum values ('OWNER', 'REFERRER', 'REFEREE')") + return value + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'PROMOTION', 'REFERRAL_PROGRAM', 'LUCKY_DRAW')") + return value + + @field_validator('voucher_type') + def voucher_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD', 'LUCKY_DRAW_CODE']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD', 'LUCKY_DRAW_CODE')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerRedeemable 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 redeemable + if self.redeemable: + _dict['redeemable'] = self.redeemable.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if redeemable_id (nullable) is None + # and model_fields_set contains the field + if self.redeemable_id is None and "redeemable_id" in self.model_fields_set: + _dict['redeemable_id'] = None + + # set to None if redeemable_object (nullable) is None + # and model_fields_set contains the field + if self.redeemable_object is None and "redeemable_object" in self.model_fields_set: + _dict['redeemable_object'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if holder_role (nullable) is None + # and model_fields_set contains the field + if self.holder_role is None and "holder_role" in self.model_fields_set: + _dict['holder_role'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if voucher_type (nullable) is None + # and model_fields_set contains the field + if self.voucher_type is None and "voucher_type" in self.model_fields_set: + _dict['voucher_type'] = None + + # set to None if redeemable (nullable) is None + # and model_fields_set contains the field + if self.redeemable is None and "redeemable" in self.model_fields_set: + _dict['redeemable'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerRedeemable 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"), + "created_at": obj.get("created_at"), + "redeemable_id": obj.get("redeemable_id"), + "redeemable_object": obj.get("redeemable_object"), + "customer_id": obj.get("customer_id"), + "holder_role": obj.get("holder_role") if obj.get("holder_role") is not None else 'OWNER', + "campaign_id": obj.get("campaign_id"), + "campaign_type": obj.get("campaign_type") if obj.get("campaign_type") is not None else 'DISCOUNT_COUPONS', + "voucher_type": obj.get("voucher_type") if obj.get("voucher_type") is not None else 'DISCOUNT_VOUCHER', + "redeemable": CustomerRedeemableRedeemable.from_dict(obj["redeemable"]) if obj.get("redeemable") is not None else None + }) + return _obj + + diff --git a/voucherify/models/customer_redeemable_redeemable.py b/voucherify/models/customer_redeemable_redeemable.py new file mode 100644 index 00000000..17b63225 --- /dev/null +++ b/voucherify/models/customer_redeemable_redeemable.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.redeemable_voucher import RedeemableVoucher +from typing import Optional, Set +from typing_extensions import Self + +class CustomerRedeemableRedeemable(BaseModel): + """ + Detailed information about the customer's redeemable item + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="Type of the redeemable.") + voucher: RedeemableVoucher + status: Optional[StrictStr] = Field(default='ACTIVE', description="Status of the redeemable.") + __properties: ClassVar[List[str]] = ["type", "voucher", "status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ACTIVE', 'USED', 'DISABLED', 'NOT_ACTIVE_YET', 'EXPIRED', 'NO_BALANCE']): + raise ValueError("must be one of enum values ('ACTIVE', 'USED', 'DISABLED', 'NOT_ACTIVE_YET', 'EXPIRED', 'NO_BALANCE')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerRedeemableRedeemable 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerRedeemableRedeemable from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "voucher": RedeemableVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "status": obj.get("status") if obj.get("status") is not None else 'ACTIVE' + }) + return _obj + + diff --git a/voucherify/models/customer_referrals.py b/voucherify/models/customer_referrals.py new file mode 100644 index 00000000..7218bba2 --- /dev/null +++ b/voucherify/models/customer_referrals.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_referrals_campaigns_item import CustomerReferralsCampaignsItem +from typing import Optional, Set +from typing_extensions import Self + +class CustomerReferrals(BaseModel): + """ + Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers. + """ # noqa: E501 + total: Optional[StrictInt] = Field(default=None, description="Total number of times this customer received a referral, i.e. was referred by another customer.") + campaigns: Optional[List[CustomerReferralsCampaignsItem]] = Field(default=None, description="Contains an array of campaigns that served as the source of a referral for the customer.") + __properties: ClassVar[List[str]] = ["total", "campaigns"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerReferrals 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 campaigns (list) + _items = [] + if self.campaigns: + for _item_campaigns in self.campaigns: + if _item_campaigns: + _items.append(_item_campaigns.to_dict()) + _dict['campaigns'] = _items + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if campaigns (nullable) is None + # and model_fields_set contains the field + if self.campaigns is None and "campaigns" in self.model_fields_set: + _dict['campaigns'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerReferrals from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "campaigns": [CustomerReferralsCampaignsItem.from_dict(_item) for _item in obj["campaigns"]] if obj.get("campaigns") is not None else None + }) + return _obj + + diff --git a/voucherify/models/customer_referrals_campaigns_item.py b/voucherify/models/customer_referrals_campaigns_item.py new file mode 100644 index 00000000..e15cf803 --- /dev/null +++ b/voucherify/models/customer_referrals_campaigns_item.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CustomerReferralsCampaignsItem(BaseModel): + """ + Contains information about the source of the referral. + """ # noqa: E501 + campaign_id: StrictStr = Field(description="Unique campaign ID, assigned by Voucherify.") + referrer_id: StrictStr = Field(description="Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer.") + related_object_id: StrictStr = Field(description="Related object id") + related_object_type: StrictStr = Field(description="Related object type, i.e. `redemption`.") + var_date: datetime = Field(description="Timestamp representing the date and time when the customer was referred in ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["campaign_id", "referrer_id", "related_object_id", "related_object_type", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerReferralsCampaignsItem 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 CustomerReferralsCampaignsItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "campaign_id": obj.get("campaign_id"), + "referrer_id": obj.get("referrer_id"), + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/customer_summary.py b/voucherify/models/customer_summary.py new file mode 100644 index 00000000..cfdd4706 --- /dev/null +++ b/voucherify/models/customer_summary.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List +from voucherify.models.customer_summary_orders import CustomerSummaryOrders +from voucherify.models.customer_summary_redemptions import CustomerSummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class CustomerSummary(BaseModel): + """ + CustomerSummary + """ # noqa: E501 + redemptions: CustomerSummaryRedemptions + orders: CustomerSummaryOrders + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerSummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": CustomerSummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": CustomerSummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/customer_summary_orders.py b/voucherify/models/customer_summary_orders.py new file mode 100644 index 00000000..3c0069e3 --- /dev/null +++ b/voucherify/models/customer_summary_orders.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerSummaryOrders(BaseModel): + """ + CustomerSummaryOrders + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + total_count: Optional[StrictInt] = Field(default=None, description="Total number of orders made by the customer.") + average_amount: Optional[StrictInt] = Field(default=None, description="Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + last_order_amount: Optional[StrictInt] = Field(default=None, description="Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + last_order_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time of the customer's last order in ISO 8601 format.") + __properties: ClassVar[List[str]] = ["total_amount", "total_count", "average_amount", "last_order_amount", "last_order_date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerSummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_count (nullable) is None + # and model_fields_set contains the field + if self.total_count is None and "total_count" in self.model_fields_set: + _dict['total_count'] = None + + # set to None if average_amount (nullable) is None + # and model_fields_set contains the field + if self.average_amount is None and "average_amount" in self.model_fields_set: + _dict['average_amount'] = None + + # set to None if last_order_amount (nullable) is None + # and model_fields_set contains the field + if self.last_order_amount is None and "last_order_amount" in self.model_fields_set: + _dict['last_order_amount'] = None + + # set to None if last_order_date (nullable) is None + # and model_fields_set contains the field + if self.last_order_date is None and "last_order_date" in self.model_fields_set: + _dict['last_order_date'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerSummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_count": obj.get("total_count"), + "average_amount": obj.get("average_amount"), + "last_order_amount": obj.get("last_order_amount"), + "last_order_date": obj.get("last_order_date") + }) + return _obj + + diff --git a/voucherify/models/customer_summary_redemptions.py b/voucherify/models/customer_summary_redemptions.py new file mode 100644 index 00000000..fdae9066 --- /dev/null +++ b/voucherify/models/customer_summary_redemptions.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_summary_redemptions_gift import CustomerSummaryRedemptionsGift +from voucherify.models.customer_summary_redemptions_loyalty_card import CustomerSummaryRedemptionsLoyaltyCard +from typing import Optional, Set +from typing_extensions import Self + +class CustomerSummaryRedemptions(BaseModel): + """ + CustomerSummaryRedemptions + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Total number of redemptions made by the customer.") + total_failed: Optional[StrictInt] = Field(default=None, description="Total number of redemptions that failed.") + total_succeeded: Optional[StrictInt] = Field(default=None, description="Total number of redemptions that succeeded.") + total_rolled_back: Optional[StrictInt] = Field(default=None, description="Total number of redemptions that were rolled back for the customer.") + total_rollback_failed: Optional[StrictInt] = Field(default=None, description="Total number of redemption rollbacks that failed.") + total_rollback_succeeded: Optional[StrictInt] = Field(default=None, description="Total number of redemption rollbacks that succeeded.") + gift: Optional[CustomerSummaryRedemptionsGift] = None + loyalty_card: Optional[CustomerSummaryRedemptionsLoyaltyCard] = None + __properties: ClassVar[List[str]] = ["total_redeemed", "total_failed", "total_succeeded", "total_rolled_back", "total_rollback_failed", "total_rollback_succeeded", "gift", "loyalty_card"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerSummaryRedemptions 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 gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + # set to None if total_failed (nullable) is None + # and model_fields_set contains the field + if self.total_failed is None and "total_failed" in self.model_fields_set: + _dict['total_failed'] = None + + # set to None if total_succeeded (nullable) is None + # and model_fields_set contains the field + if self.total_succeeded is None and "total_succeeded" in self.model_fields_set: + _dict['total_succeeded'] = None + + # set to None if total_rolled_back (nullable) is None + # and model_fields_set contains the field + if self.total_rolled_back is None and "total_rolled_back" in self.model_fields_set: + _dict['total_rolled_back'] = None + + # set to None if total_rollback_failed (nullable) is None + # and model_fields_set contains the field + if self.total_rollback_failed is None and "total_rollback_failed" in self.model_fields_set: + _dict['total_rollback_failed'] = None + + # set to None if total_rollback_succeeded (nullable) is None + # and model_fields_set contains the field + if self.total_rollback_succeeded is None and "total_rollback_succeeded" in self.model_fields_set: + _dict['total_rollback_succeeded'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerSummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed"), + "total_failed": obj.get("total_failed"), + "total_succeeded": obj.get("total_succeeded"), + "total_rolled_back": obj.get("total_rolled_back"), + "total_rollback_failed": obj.get("total_rollback_failed"), + "total_rollback_succeeded": obj.get("total_rollback_succeeded"), + "gift": CustomerSummaryRedemptionsGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": CustomerSummaryRedemptionsLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None + }) + return _obj + + diff --git a/voucherify/models/customer_summary_redemptions_gift.py b/voucherify/models/customer_summary_redemptions_gift.py new file mode 100644 index 00000000..537503ac --- /dev/null +++ b/voucherify/models/customer_summary_redemptions_gift.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerSummaryRedemptionsGift(BaseModel): + """ + Summary of gift card credits. + """ # noqa: E501 + redeemed_amount: Optional[StrictInt] = Field(default=0, description="Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + amount_to_go: Optional[StrictInt] = Field(default=0, description="Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + __properties: ClassVar[List[str]] = ["redeemed_amount", "amount_to_go"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerSummaryRedemptionsGift 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, + ) + # set to None if redeemed_amount (nullable) is None + # and model_fields_set contains the field + if self.redeemed_amount is None and "redeemed_amount" in self.model_fields_set: + _dict['redeemed_amount'] = None + + # set to None if amount_to_go (nullable) is None + # and model_fields_set contains the field + if self.amount_to_go is None and "amount_to_go" in self.model_fields_set: + _dict['amount_to_go'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerSummaryRedemptionsGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redeemed_amount": obj.get("redeemed_amount") if obj.get("redeemed_amount") is not None else 0, + "amount_to_go": obj.get("amount_to_go") if obj.get("amount_to_go") is not None else 0 + }) + return _obj + + diff --git a/voucherify/models/customer_summary_redemptions_loyalty_card.py b/voucherify/models/customer_summary_redemptions_loyalty_card.py new file mode 100644 index 00000000..5c647ab9 --- /dev/null +++ b/voucherify/models/customer_summary_redemptions_loyalty_card.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerSummaryRedemptionsLoyaltyCard(BaseModel): + """ + Summary of loyalty points. + """ # noqa: E501 + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total number of loyalty points redeemed by the customer.") + points_to_go: Optional[StrictInt] = Field(default=None, description="Sum of remaining available point balance across all loyalty cards.") + __properties: ClassVar[List[str]] = ["redeemed_points", "points_to_go"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerSummaryRedemptionsLoyaltyCard 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, + ) + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if points_to_go (nullable) is None + # and model_fields_set contains the field + if self.points_to_go is None and "points_to_go" in self.model_fields_set: + _dict['points_to_go'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerSummaryRedemptionsLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redeemed_points": obj.get("redeemed_points"), + "points_to_go": obj.get("points_to_go") + }) + return _obj + + diff --git a/voucherify/models/customer_with_summary_loyalty_referrals.py b/voucherify/models/customer_with_summary_loyalty_referrals.py new file mode 100644 index 00000000..145c7aa9 --- /dev/null +++ b/voucherify/models/customer_with_summary_loyalty_referrals.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_loyalty import CustomerLoyalty +from voucherify.models.customer_referrals import CustomerReferrals +from voucherify.models.customer_summary import CustomerSummary +from voucherify.models.customer_with_summary_loyalty_referrals_address import CustomerWithSummaryLoyaltyReferralsAddress +from voucherify.models.customer_with_summary_loyalty_referrals_assets import CustomerWithSummaryLoyaltyReferralsAssets +from typing import Optional, Set +from typing_extensions import Self + +class CustomerWithSummaryLoyaltyReferrals(BaseModel): + """ + CustomerWithSummaryLoyaltyReferrals + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer that will be linked to redemption in this request.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + summary: Optional[CustomerSummary] = None + loyalty: Optional[CustomerLoyalty] = None + referrals: Optional[CustomerReferrals] = None + system_metadata: Optional[Dict[str, Any]] = Field(default=None, description="Object used to store system metadata information.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format.") + assets: Optional[CustomerWithSummaryLoyaltyReferralsAssets] = None + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomerWithSummaryLoyaltyReferralsAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["id", "source_id", "summary", "loyalty", "referrals", "system_metadata", "created_at", "updated_at", "assets", "object", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerWithSummaryLoyaltyReferrals 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 summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrals + if self.referrals: + _dict['referrals'] = self.referrals.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if system_metadata (nullable) is None + # and model_fields_set contains the field + if self.system_metadata is None and "system_metadata" in self.model_fields_set: + _dict['system_metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assets (nullable) is None + # and model_fields_set contains the field + if self.assets is None and "assets" in self.model_fields_set: + _dict['assets'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerWithSummaryLoyaltyReferrals 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"), + "source_id": obj.get("source_id"), + "summary": CustomerSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "loyalty": CustomerLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "referrals": CustomerReferrals.from_dict(obj["referrals"]) if obj.get("referrals") is not None else None, + "system_metadata": obj.get("system_metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assets": CustomerWithSummaryLoyaltyReferralsAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'customer', + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomerWithSummaryLoyaltyReferralsAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customer_with_summary_loyalty_referrals_address.py b/voucherify/models/customer_with_summary_loyalty_referrals_address.py new file mode 100644 index 00000000..2006ab2d --- /dev/null +++ b/voucherify/models/customer_with_summary_loyalty_referrals_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerWithSummaryLoyaltyReferralsAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerWithSummaryLoyaltyReferralsAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerWithSummaryLoyaltyReferralsAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customer_with_summary_loyalty_referrals_assets.py b/voucherify/models/customer_with_summary_loyalty_referrals_assets.py new file mode 100644 index 00000000..511d5355 --- /dev/null +++ b/voucherify/models/customer_with_summary_loyalty_referrals_assets.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomerWithSummaryLoyaltyReferralsAssets(BaseModel): + """ + Contains information about the customer's cockpit. + """ # noqa: E501 + cockpit_url: Optional[StrictStr] = Field(default=None, description="Customer's cockpit URL address.") + __properties: ClassVar[List[str]] = ["cockpit_url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerWithSummaryLoyaltyReferralsAssets 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, + ) + # set to None if cockpit_url (nullable) is None + # and model_fields_set contains the field + if self.cockpit_url is None and "cockpit_url" in self.model_fields_set: + _dict['cockpit_url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerWithSummaryLoyaltyReferralsAssets from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cockpit_url": obj.get("cockpit_url") + }) + return _obj + + diff --git a/voucherify/models/customers_activity_list_response_body.py b/voucherify/models/customers_activity_list_response_body.py new file mode 100644 index 00000000..fca5264b --- /dev/null +++ b/voucherify/models/customers_activity_list_response_body.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_activity import CustomerActivity +from typing import Optional, Set +from typing_extensions import Self + +class CustomersActivityListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/customers/{customerId}/activity`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about customer activities in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of customer activity objects.") + data: Optional[List[CustomerActivity]] = Field(default=None, description="Array of customer activity objects.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results.") + more_starting_after: Optional[StrictStr] = Field(default=None, description="Returns an ID that can be used to return another page of results. Use the event ID in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "has_more", "more_starting_after"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersActivityListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + # set to None if more_starting_after (nullable) is None + # and model_fields_set contains the field + if self.more_starting_after is None and "more_starting_after" in self.model_fields_set: + _dict['more_starting_after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersActivityListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [CustomerActivity.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "more_starting_after": obj.get("more_starting_after") + }) + return _obj + + diff --git a/voucherify/models/customers_create_request_body.py b/voucherify/models/customers_create_request_body.py new file mode 100644 index 00000000..8bd54782 --- /dev/null +++ b/voucherify/models/customers_create_request_body.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customers_create_request_body_address import CustomersCreateRequestBodyAddress +from typing import Optional, Set +from typing_extensions import Self + +class CustomersCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/customers`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomersCreateRequestBodyAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersCreateRequestBody 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 address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersCreateRequestBody 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomersCreateRequestBodyAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customers_create_request_body_address.py b/voucherify/models/customers_create_request_body_address.py new file mode 100644 index 00000000..5adf1663 --- /dev/null +++ b/voucherify/models/customers_create_request_body_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersCreateRequestBodyAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersCreateRequestBodyAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersCreateRequestBodyAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customers_create_response_body.py b/voucherify/models/customers_create_response_body.py new file mode 100644 index 00000000..0f0200f8 --- /dev/null +++ b/voucherify/models/customers_create_response_body.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_loyalty import CustomerLoyalty +from voucherify.models.customer_referrals import CustomerReferrals +from voucherify.models.customer_summary import CustomerSummary +from voucherify.models.customers_create_response_body_address import CustomersCreateResponseBodyAddress +from voucherify.models.customers_create_response_body_assets import CustomersCreateResponseBodyAssets +from typing import Optional, Set +from typing_extensions import Self + +class CustomersCreateResponseBody(BaseModel): + """ + Response body for **POST** `v1/customers`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer that will be linked to redemption in this request.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + summary: Optional[CustomerSummary] = None + loyalty: Optional[CustomerLoyalty] = None + referrals: Optional[CustomerReferrals] = None + system_metadata: Optional[Dict[str, Any]] = Field(default=None, description="Object used to store system metadata information.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format.") + assets: Optional[CustomersCreateResponseBodyAssets] = None + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomersCreateResponseBodyAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["id", "source_id", "summary", "loyalty", "referrals", "system_metadata", "created_at", "updated_at", "assets", "object", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersCreateResponseBody 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 summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrals + if self.referrals: + _dict['referrals'] = self.referrals.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if system_metadata (nullable) is None + # and model_fields_set contains the field + if self.system_metadata is None and "system_metadata" in self.model_fields_set: + _dict['system_metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assets (nullable) is None + # and model_fields_set contains the field + if self.assets is None and "assets" in self.model_fields_set: + _dict['assets'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersCreateResponseBody 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"), + "source_id": obj.get("source_id"), + "summary": CustomerSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "loyalty": CustomerLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "referrals": CustomerReferrals.from_dict(obj["referrals"]) if obj.get("referrals") is not None else None, + "system_metadata": obj.get("system_metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assets": CustomersCreateResponseBodyAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'customer', + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomersCreateResponseBodyAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customers_create_response_body_address.py b/voucherify/models/customers_create_response_body_address.py new file mode 100644 index 00000000..7f07fa4b --- /dev/null +++ b/voucherify/models/customers_create_response_body_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersCreateResponseBodyAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersCreateResponseBodyAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersCreateResponseBodyAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customers_create_response_body_assets.py b/voucherify/models/customers_create_response_body_assets.py new file mode 100644 index 00000000..8a1eb217 --- /dev/null +++ b/voucherify/models/customers_create_response_body_assets.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersCreateResponseBodyAssets(BaseModel): + """ + Contains information about the customer's cockpit. + """ # noqa: E501 + cockpit_url: Optional[StrictStr] = Field(default=None, description="Customer's cockpit URL address.") + __properties: ClassVar[List[str]] = ["cockpit_url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersCreateResponseBodyAssets 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, + ) + # set to None if cockpit_url (nullable) is None + # and model_fields_set contains the field + if self.cockpit_url is None and "cockpit_url" in self.model_fields_set: + _dict['cockpit_url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersCreateResponseBodyAssets from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cockpit_url": obj.get("cockpit_url") + }) + return _obj + + diff --git a/voucherify/models/customers_get_response_body.py b/voucherify/models/customers_get_response_body.py new file mode 100644 index 00000000..ac1ce8c3 --- /dev/null +++ b/voucherify/models/customers_get_response_body.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_loyalty import CustomerLoyalty +from voucherify.models.customer_referrals import CustomerReferrals +from voucherify.models.customer_summary import CustomerSummary +from voucherify.models.customers_get_response_body_address import CustomersGetResponseBodyAddress +from voucherify.models.customers_get_response_body_assets import CustomersGetResponseBodyAssets +from typing import Optional, Set +from typing_extensions import Self + +class CustomersGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/customers/{customerId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer that will be linked to redemption in this request.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + summary: Optional[CustomerSummary] = None + loyalty: Optional[CustomerLoyalty] = None + referrals: Optional[CustomerReferrals] = None + system_metadata: Optional[Dict[str, Any]] = Field(default=None, description="Object used to store system metadata information.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format.") + assets: Optional[CustomersGetResponseBodyAssets] = None + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomersGetResponseBodyAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["id", "source_id", "summary", "loyalty", "referrals", "system_metadata", "created_at", "updated_at", "assets", "object", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersGetResponseBody 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 summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrals + if self.referrals: + _dict['referrals'] = self.referrals.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if system_metadata (nullable) is None + # and model_fields_set contains the field + if self.system_metadata is None and "system_metadata" in self.model_fields_set: + _dict['system_metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assets (nullable) is None + # and model_fields_set contains the field + if self.assets is None and "assets" in self.model_fields_set: + _dict['assets'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersGetResponseBody 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"), + "source_id": obj.get("source_id"), + "summary": CustomerSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "loyalty": CustomerLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "referrals": CustomerReferrals.from_dict(obj["referrals"]) if obj.get("referrals") is not None else None, + "system_metadata": obj.get("system_metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assets": CustomersGetResponseBodyAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'customer', + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomersGetResponseBodyAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customers_get_response_body_address.py b/voucherify/models/customers_get_response_body_address.py new file mode 100644 index 00000000..6d40c970 --- /dev/null +++ b/voucherify/models/customers_get_response_body_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersGetResponseBodyAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersGetResponseBodyAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersGetResponseBodyAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customers_get_response_body_assets.py b/voucherify/models/customers_get_response_body_assets.py new file mode 100644 index 00000000..fd34ec3f --- /dev/null +++ b/voucherify/models/customers_get_response_body_assets.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersGetResponseBodyAssets(BaseModel): + """ + Contains information about the customer's cockpit. + """ # noqa: E501 + cockpit_url: Optional[StrictStr] = Field(default=None, description="Customer's cockpit URL address.") + __properties: ClassVar[List[str]] = ["cockpit_url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersGetResponseBodyAssets 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, + ) + # set to None if cockpit_url (nullable) is None + # and model_fields_set contains the field + if self.cockpit_url is None and "cockpit_url" in self.model_fields_set: + _dict['cockpit_url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersGetResponseBodyAssets from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cockpit_url": obj.get("cockpit_url") + }) + return _obj + + diff --git a/voucherify/models/customers_import_csv_create_response_body.py b/voucherify/models/customers_import_csv_create_response_body.py new file mode 100644 index 00000000..683a577d --- /dev/null +++ b/voucherify/models/customers_import_csv_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersImportCsvCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/customers/importCSV`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersImportCsvCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersImportCsvCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/customers_list_response_body.py b/voucherify/models/customers_list_response_body.py new file mode 100644 index 00000000..6b380373 --- /dev/null +++ b/voucherify/models/customers_list_response_body.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_with_summary_loyalty_referrals import CustomerWithSummaryLoyaltyReferrals +from typing import Optional, Set +from typing_extensions import Self + +class CustomersListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/customers`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about customers in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='customers', description="Identifies the name of the attribute that contains the array of customer objects.") + customers: Optional[List[CustomerWithSummaryLoyaltyReferrals]] = Field(default=None, description="Contains array of customer objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of customers.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different end date filter) to get more records returned in the results.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "customers", "total", "has_more"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersListResponseBody 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 customers (list) + _items = [] + if self.customers: + for _item_customers in self.customers: + if _item_customers: + _items.append(_item_customers.to_dict()) + _dict['customers'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if customers (nullable) is None + # and model_fields_set contains the field + if self.customers is None and "customers" in self.model_fields_set: + _dict['customers'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'customers', + "customers": [CustomerWithSummaryLoyaltyReferrals.from_dict(_item) for _item in obj["customers"]] if obj.get("customers") is not None else None, + "total": obj.get("total"), + "has_more": obj.get("has_more") + }) + return _obj + + diff --git a/voucherify/models/customers_metadata_update_in_bulk_request_body.py b/voucherify/models/customers_metadata_update_in_bulk_request_body.py new file mode 100644 index 00000000..11e3fe53 --- /dev/null +++ b/voucherify/models/customers_metadata_update_in_bulk_request_body.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersMetadataUpdateInBulkRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/customers/metadata/async`. + """ # noqa: E501 + source_ids: Optional[List[StrictStr]] = Field(default=None, description="An array of customer `source_id`'s.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["source_ids", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersMetadataUpdateInBulkRequestBody 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, + ) + # set to None if source_ids (nullable) is None + # and model_fields_set contains the field + if self.source_ids is None and "source_ids" in self.model_fields_set: + _dict['source_ids'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersMetadataUpdateInBulkRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source_ids": obj.get("source_ids"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customers_metadata_update_in_bulk_response_body.py b/voucherify/models/customers_metadata_update_in_bulk_response_body.py new file mode 100644 index 00000000..5f36dd58 --- /dev/null +++ b/voucherify/models/customers_metadata_update_in_bulk_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersMetadataUpdateInBulkResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/customers/metadata/async`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersMetadataUpdateInBulkResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersMetadataUpdateInBulkResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/customers_permanent_deletion_create_response_body.py b/voucherify/models/customers_permanent_deletion_create_response_body.py new file mode 100644 index 00000000..c08482b2 --- /dev/null +++ b/voucherify/models/customers_permanent_deletion_create_response_body.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customers_permanent_deletion_create_response_body_data_json import CustomersPermanentDeletionCreateResponseBodyDataJson +from typing import Optional, Set +from typing_extensions import Self + +class CustomersPermanentDeletionCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/customers/{customerId}/permanent-deletion`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique permanent deletion object ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID that is being deleted.") + related_object: Optional[StrictStr] = Field(default='customer', description="Object being deleted.") + status: Optional[StrictStr] = Field(default='DONE', description="Deletion status.") + data_json: Optional[CustomersPermanentDeletionCreateResponseBodyDataJson] = None + object: Optional[StrictStr] = Field(default='pernament_deletion', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "created_at", "related_object_id", "related_object", "status", "data_json", "object"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersPermanentDeletionCreateResponseBody 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 data_json + if self.data_json: + _dict['data_json'] = self.data_json.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object (nullable) is None + # and model_fields_set contains the field + if self.related_object is None and "related_object" in self.model_fields_set: + _dict['related_object'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if data_json (nullable) is None + # and model_fields_set contains the field + if self.data_json is None and "data_json" in self.model_fields_set: + _dict['data_json'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersPermanentDeletionCreateResponseBody 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"), + "created_at": obj.get("created_at"), + "related_object_id": obj.get("related_object_id"), + "related_object": obj.get("related_object") if obj.get("related_object") is not None else 'customer', + "status": obj.get("status") if obj.get("status") is not None else 'DONE', + "data_json": CustomersPermanentDeletionCreateResponseBodyDataJson.from_dict(obj["data_json"]) if obj.get("data_json") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'pernament_deletion' + }) + return _obj + + diff --git a/voucherify/models/customers_permanent_deletion_create_response_body_data_json.py b/voucherify/models/customers_permanent_deletion_create_response_body_data_json.py new file mode 100644 index 00000000..975568f4 --- /dev/null +++ b/voucherify/models/customers_permanent_deletion_create_response_body_data_json.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersPermanentDeletionCreateResponseBodyDataJson(BaseModel): + """ + Statistics summarizing the number of related information that was deleted. + """ # noqa: E501 + events: Optional[StrictInt] = Field(default=None, description="Number of events deleted.") + customer_events: Optional[StrictInt] = Field(default=None, description="Number of customer events deleted.") + daily_events: Optional[StrictInt] = Field(default=None, description="Number of daily events deleted.") + segments: Optional[StrictInt] = Field(default=None, description="Number of segments deleted.") + orders: Optional[StrictInt] = Field(default=None, description="Number of orders deleted.") + order_events: Optional[StrictInt] = Field(default=None, description="Number of order events deleted.") + customer: Optional[StrictInt] = Field(default=1, description="Number of customers deleted.") + __properties: ClassVar[List[str]] = ["events", "customer_events", "daily_events", "segments", "orders", "order_events", "customer"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersPermanentDeletionCreateResponseBodyDataJson 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, + ) + # set to None if events (nullable) is None + # and model_fields_set contains the field + if self.events is None and "events" in self.model_fields_set: + _dict['events'] = None + + # set to None if customer_events (nullable) is None + # and model_fields_set contains the field + if self.customer_events is None and "customer_events" in self.model_fields_set: + _dict['customer_events'] = None + + # set to None if daily_events (nullable) is None + # and model_fields_set contains the field + if self.daily_events is None and "daily_events" in self.model_fields_set: + _dict['daily_events'] = None + + # set to None if segments (nullable) is None + # and model_fields_set contains the field + if self.segments is None and "segments" in self.model_fields_set: + _dict['segments'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + # set to None if order_events (nullable) is None + # and model_fields_set contains the field + if self.order_events is None and "order_events" in self.model_fields_set: + _dict['order_events'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersPermanentDeletionCreateResponseBodyDataJson from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "events": obj.get("events"), + "customer_events": obj.get("customer_events"), + "daily_events": obj.get("daily_events"), + "segments": obj.get("segments"), + "orders": obj.get("orders"), + "order_events": obj.get("order_events"), + "customer": obj.get("customer") if obj.get("customer") is not None else 1 + }) + return _obj + + diff --git a/voucherify/models/customers_redeemables_list_response_body.py b/voucherify/models/customers_redeemables_list_response_body.py new file mode 100644 index 00000000..a7faa8ea --- /dev/null +++ b/voucherify/models/customers_redeemables_list_response_body.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_redeemable import CustomerRedeemable +from typing import Optional, Set +from typing_extensions import Self + +class CustomersRedeemablesListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/customers/{customerId}/redeemables`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about customer redeemables.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of redeemables.") + data: Optional[List[CustomerRedeemable]] = Field(default=None, description="A dictionary that contains an array of redeemables.") + total: Optional[StrictInt] = Field(default=None, description="Total number of results returned.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results.") + more_starting_after: Optional[StrictStr] = Field(default=None, description="Returns an ID that can be used to return another page of results. Use the ID in the `starting_after_id` query parameter to display another page of the results occuring after the field with that ID.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total", "has_more", "more_starting_after"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersRedeemablesListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + # set to None if more_starting_after (nullable) is None + # and model_fields_set contains the field + if self.more_starting_after is None and "more_starting_after" in self.model_fields_set: + _dict['more_starting_after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersRedeemablesListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [CustomerRedeemable.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total"), + "has_more": obj.get("has_more"), + "more_starting_after": obj.get("more_starting_after") + }) + return _obj + + diff --git a/voucherify/models/customers_segments_list_response_body.py b/voucherify/models/customers_segments_list_response_body.py new file mode 100644 index 00000000..97d59193 --- /dev/null +++ b/voucherify/models/customers_segments_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.simple_segment import SimpleSegment +from typing import Optional, Set +from typing_extensions import Self + +class CustomersSegmentsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/customers/{customerId}/segments`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about customer segments.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of segment IDs.") + data: Optional[List[SimpleSegment]] = Field(default=None, description="A dictionary that contains an array of segment IDs and names.") + total: Optional[StrictInt] = Field(default=None, description="Total number of segments the customer belongs to.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersSegmentsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersSegmentsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [SimpleSegment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/customers_update_in_bulk_request_body.py b/voucherify/models/customers_update_in_bulk_request_body.py new file mode 100644 index 00000000..a6429c84 --- /dev/null +++ b/voucherify/models/customers_update_in_bulk_request_body.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customers_update_in_bulk_request_body_address import CustomersUpdateInBulkRequestBodyAddress +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateInBulkRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/customers/bulk/async`. + """ # noqa: E501 + source_id: Optional[StrictStr] = Field(default=None, description="Unique customer source ID.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomersUpdateInBulkRequestBodyAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["source_id", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateInBulkRequestBody 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 address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateInBulkRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomersUpdateInBulkRequestBodyAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customers_update_in_bulk_request_body_address.py b/voucherify/models/customers_update_in_bulk_request_body_address.py new file mode 100644 index 00000000..12ad7045 --- /dev/null +++ b/voucherify/models/customers_update_in_bulk_request_body_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateInBulkRequestBodyAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateInBulkRequestBodyAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateInBulkRequestBodyAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customers_update_in_bulk_response_body.py b/voucherify/models/customers_update_in_bulk_response_body.py new file mode 100644 index 00000000..ab11091f --- /dev/null +++ b/voucherify/models/customers_update_in_bulk_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateInBulkResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/customers/bulk/async`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateInBulkResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateInBulkResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/customers_update_request_body.py b/voucherify/models/customers_update_request_body.py new file mode 100644 index 00000000..2f230c42 --- /dev/null +++ b/voucherify/models/customers_update_request_body.py @@ -0,0 +1,147 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customers_update_request_body_address import CustomersUpdateRequestBodyAddress +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateRequestBody(BaseModel): + """ + Request body schema for **PUT** `v1/customers/{customerId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomersUpdateRequestBodyAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateRequestBody 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 address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateRequestBody 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"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomersUpdateRequestBodyAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customers_update_request_body_address.py b/voucherify/models/customers_update_request_body_address.py new file mode 100644 index 00000000..1c4275b3 --- /dev/null +++ b/voucherify/models/customers_update_request_body_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateRequestBodyAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateRequestBodyAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateRequestBodyAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customers_update_response_body.py b/voucherify/models/customers_update_response_body.py new file mode 100644 index 00000000..4fd65c02 --- /dev/null +++ b/voucherify/models/customers_update_response_body.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_loyalty import CustomerLoyalty +from voucherify.models.customer_referrals import CustomerReferrals +from voucherify.models.customer_summary import CustomerSummary +from voucherify.models.customers_update_response_body_address import CustomersUpdateResponseBodyAddress +from voucherify.models.customers_update_response_body_assets import CustomersUpdateResponseBodyAssets +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/customers/{customerId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer that will be linked to redemption in this request.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + summary: Optional[CustomerSummary] = None + loyalty: Optional[CustomerLoyalty] = None + referrals: Optional[CustomerReferrals] = None + system_metadata: Optional[Dict[str, Any]] = Field(default=None, description="Object used to store system metadata information.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the customer was updated. The value is shown in the ISO 8601 format.") + assets: Optional[CustomersUpdateResponseBodyAssets] = None + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[CustomersUpdateResponseBodyAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["id", "source_id", "summary", "loyalty", "referrals", "system_metadata", "created_at", "updated_at", "assets", "object", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateResponseBody 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 summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrals + if self.referrals: + _dict['referrals'] = self.referrals.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if system_metadata (nullable) is None + # and model_fields_set contains the field + if self.system_metadata is None and "system_metadata" in self.model_fields_set: + _dict['system_metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assets (nullable) is None + # and model_fields_set contains the field + if self.assets is None and "assets" in self.model_fields_set: + _dict['assets'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateResponseBody 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"), + "source_id": obj.get("source_id"), + "summary": CustomerSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "loyalty": CustomerLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "referrals": CustomerReferrals.from_dict(obj["referrals"]) if obj.get("referrals") is not None else None, + "system_metadata": obj.get("system_metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assets": CustomersUpdateResponseBodyAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'customer', + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": CustomersUpdateResponseBodyAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/customers_update_response_body_address.py b/voucherify/models/customers_update_response_body_address.py new file mode 100644 index 00000000..962496b2 --- /dev/null +++ b/voucherify/models/customers_update_response_body_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateResponseBodyAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateResponseBodyAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateResponseBodyAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/customers_update_response_body_assets.py b/voucherify/models/customers_update_response_body_assets.py new file mode 100644 index 00000000..e2ef2c60 --- /dev/null +++ b/voucherify/models/customers_update_response_body_assets.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomersUpdateResponseBodyAssets(BaseModel): + """ + Contains information about the customer's cockpit. + """ # noqa: E501 + cockpit_url: Optional[StrictStr] = Field(default=None, description="Customer's cockpit URL address.") + __properties: ClassVar[List[str]] = ["cockpit_url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomersUpdateResponseBodyAssets 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, + ) + # set to None if cockpit_url (nullable) is None + # and model_fields_set contains the field + if self.cockpit_url is None and "cockpit_url" in self.model_fields_set: + _dict['cockpit_url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomersUpdateResponseBodyAssets from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cockpit_url": obj.get("cockpit_url") + }) + return _obj + + diff --git a/voucherify/models/discount.py b/voucherify/models/discount.py new file mode 100644 index 00000000..715b72a3 --- /dev/null +++ b/voucherify/models/discount.py @@ -0,0 +1,231 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from voucherify.models.discount_unit_multiple_one_unit import DiscountUnitMultipleOneUnit +from voucherify.models.simple_product_discount_unit import SimpleProductDiscountUnit +from voucherify.models.simple_sku_discount_unit import SimpleSkuDiscountUnit +from typing import Optional, Set +from typing_extensions import Self + +class Discount(BaseModel): + """ + Discount + """ # noqa: E501 + type: Optional[StrictStr] = None + amount_off: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000.") + amount_off_formula: Optional[StrictStr] = None + aggregated_amount_limit: Optional[StrictInt] = Field(default=None, description="Maximum discount amount per order.") + effect: Optional[StrictStr] = None + is_dynamic: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the discount was calculated using a formula.") + unit_off: Optional[StrictInt] = Field(default=None, description="Number of units to be granted a full value discount.") + unit_off_formula: Optional[StrictStr] = None + unit_type: Optional[StrictStr] = Field(default=None, description="The product deemed as free, chosen from product inventory (e.g. time, items).") + product: Optional[SimpleProductDiscountUnit] = None + sku: Optional[SimpleSkuDiscountUnit] = None + units: Optional[List[DiscountUnitMultipleOneUnit]] = None + percent_off: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The percent discount that the customer will receive.") + percent_off_formula: Optional[StrictStr] = None + amount_limit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.") + fixed_amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value.") + fixed_amount_formula: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type", "amount_off", "amount_off_formula", "aggregated_amount_limit", "effect", "is_dynamic", "unit_off", "unit_off_formula", "unit_type", "product", "sku", "units", "percent_off", "percent_off_formula", "amount_limit", "fixed_amount", "fixed_amount_formula"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AMOUNT', 'UNIT', 'PERCENT', 'FIXED']): + raise ValueError("must be one of enum values ('AMOUNT', 'UNIT', 'PERCENT', 'FIXED')") + return value + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS', 'APPLY_TO_ITEMS_PROPORTIONALLY', 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY', 'APPLY_TO_ITEMS_BY_QUANTITY', 'ADD_MISSING_ITEMS', 'ADD_NEW_ITEMS', 'ADD_MANY_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS', 'APPLY_TO_ITEMS_PROPORTIONALLY', 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY', 'APPLY_TO_ITEMS_BY_QUANTITY', 'ADD_MISSING_ITEMS', 'ADD_NEW_ITEMS', 'ADD_MANY_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Discount 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 product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of sku + if self.sku: + _dict['sku'] = self.sku.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in units (list) + _items = [] + if self.units: + for _item_units in self.units: + if _item_units: + _items.append(_item_units.to_dict()) + _dict['units'] = _items + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if amount_off (nullable) is None + # and model_fields_set contains the field + if self.amount_off is None and "amount_off" in self.model_fields_set: + _dict['amount_off'] = None + + # set to None if amount_off_formula (nullable) is None + # and model_fields_set contains the field + if self.amount_off_formula is None and "amount_off_formula" in self.model_fields_set: + _dict['amount_off_formula'] = None + + # set to None if aggregated_amount_limit (nullable) is None + # and model_fields_set contains the field + if self.aggregated_amount_limit is None and "aggregated_amount_limit" in self.model_fields_set: + _dict['aggregated_amount_limit'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + # set to None if is_dynamic (nullable) is None + # and model_fields_set contains the field + if self.is_dynamic is None and "is_dynamic" in self.model_fields_set: + _dict['is_dynamic'] = None + + # set to None if unit_off (nullable) is None + # and model_fields_set contains the field + if self.unit_off is None and "unit_off" in self.model_fields_set: + _dict['unit_off'] = None + + # set to None if unit_off_formula (nullable) is None + # and model_fields_set contains the field + if self.unit_off_formula is None and "unit_off_formula" in self.model_fields_set: + _dict['unit_off_formula'] = None + + # set to None if unit_type (nullable) is None + # and model_fields_set contains the field + if self.unit_type is None and "unit_type" in self.model_fields_set: + _dict['unit_type'] = None + + # set to None if units (nullable) is None + # and model_fields_set contains the field + if self.units is None and "units" in self.model_fields_set: + _dict['units'] = None + + # set to None if percent_off (nullable) is None + # and model_fields_set contains the field + if self.percent_off is None and "percent_off" in self.model_fields_set: + _dict['percent_off'] = None + + # set to None if percent_off_formula (nullable) is None + # and model_fields_set contains the field + if self.percent_off_formula is None and "percent_off_formula" in self.model_fields_set: + _dict['percent_off_formula'] = None + + # set to None if amount_limit (nullable) is None + # and model_fields_set contains the field + if self.amount_limit is None and "amount_limit" in self.model_fields_set: + _dict['amount_limit'] = None + + # set to None if fixed_amount (nullable) is None + # and model_fields_set contains the field + if self.fixed_amount is None and "fixed_amount" in self.model_fields_set: + _dict['fixed_amount'] = None + + # set to None if fixed_amount_formula (nullable) is None + # and model_fields_set contains the field + if self.fixed_amount_formula is None and "fixed_amount_formula" in self.model_fields_set: + _dict['fixed_amount_formula'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Discount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "amount_off": obj.get("amount_off"), + "amount_off_formula": obj.get("amount_off_formula"), + "aggregated_amount_limit": obj.get("aggregated_amount_limit"), + "effect": obj.get("effect"), + "is_dynamic": obj.get("is_dynamic"), + "unit_off": obj.get("unit_off"), + "unit_off_formula": obj.get("unit_off_formula"), + "unit_type": obj.get("unit_type"), + "product": SimpleProductDiscountUnit.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sku": SimpleSkuDiscountUnit.from_dict(obj["sku"]) if obj.get("sku") is not None else None, + "units": [DiscountUnitMultipleOneUnit.from_dict(_item) for _item in obj["units"]] if obj.get("units") is not None else None, + "percent_off": obj.get("percent_off"), + "percent_off_formula": obj.get("percent_off_formula"), + "amount_limit": obj.get("amount_limit"), + "fixed_amount": obj.get("fixed_amount"), + "fixed_amount_formula": obj.get("fixed_amount_formula") + }) + return _obj + + diff --git a/voucherify/models/discount_unit_multiple_one_unit.py b/voucherify/models/discount_unit_multiple_one_unit.py new file mode 100644 index 00000000..76ee2067 --- /dev/null +++ b/voucherify/models/discount_unit_multiple_one_unit.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from voucherify.models.simple_product_discount_unit import SimpleProductDiscountUnit +from voucherify.models.simple_sku_discount_unit import SimpleSkuDiscountUnit +from typing import Optional, Set +from typing_extensions import Self + +class DiscountUnitMultipleOneUnit(BaseModel): + """ + DiscountUnitMultipleOneUnit + """ # noqa: E501 + unit_off: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number of units to be granted a full value discount.") + unit_off_formula: Optional[StrictStr] = None + effect: Optional[StrictStr] = Field(default=None, description="Defines how the unit is added to the customer's order. ") + unit_type: Optional[StrictStr] = Field(default=None, description="The product deemed as free, chosen from product inventory (e.g. time, items).") + product: Optional[SimpleProductDiscountUnit] = None + sku: Optional[SimpleSkuDiscountUnit] = None + __properties: ClassVar[List[str]] = ["unit_off", "unit_off_formula", "effect", "unit_type", "product", "sku"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ADD_NEW_ITEMS', 'ADD_MISSING_ITEMS']): + raise ValueError("must be one of enum values ('ADD_NEW_ITEMS', 'ADD_MISSING_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DiscountUnitMultipleOneUnit 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 product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of sku + if self.sku: + _dict['sku'] = self.sku.to_dict() + # set to None if unit_off (nullable) is None + # and model_fields_set contains the field + if self.unit_off is None and "unit_off" in self.model_fields_set: + _dict['unit_off'] = None + + # set to None if unit_off_formula (nullable) is None + # and model_fields_set contains the field + if self.unit_off_formula is None and "unit_off_formula" in self.model_fields_set: + _dict['unit_off_formula'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + # set to None if unit_type (nullable) is None + # and model_fields_set contains the field + if self.unit_type is None and "unit_type" in self.model_fields_set: + _dict['unit_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DiscountUnitMultipleOneUnit from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "unit_off": obj.get("unit_off"), + "unit_off_formula": obj.get("unit_off_formula"), + "effect": obj.get("effect"), + "unit_type": obj.get("unit_type"), + "product": SimpleProductDiscountUnit.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sku": SimpleSkuDiscountUnit.from_dict(obj["sku"]) if obj.get("sku") is not None else None + }) + return _obj + + diff --git a/voucherify/models/earning_rule.py b/voucherify/models/earning_rule.py new file mode 100644 index 00000000..3b5863c5 --- /dev/null +++ b/voucherify/models/earning_rule.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.earning_rule_custom_event import EarningRuleCustomEvent +from voucherify.models.earning_rule_loyalty import EarningRuleLoyalty +from voucherify.models.earning_rule_loyalty_tier import EarningRuleLoyaltyTier +from voucherify.models.earning_rule_segment import EarningRuleSegment +from voucherify.models.earning_rule_source import EarningRuleSource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class EarningRule(BaseModel): + """ + EarningRule + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the earning rule object.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.") + loyalty: Optional[EarningRuleLoyalty] = None + event: Optional[StrictStr] = None + custom_event: Optional[EarningRuleCustomEvent] = None + segment: Optional[EarningRuleSegment] = None + loyalty_tier: Optional[EarningRuleLoyaltyTier] = None + source: Optional[EarningRuleSource] = None + object: Optional[StrictStr] = Field(default='earning_rule', description="The type of the object represented by JSON. Default is earning_rule.") + automation_id: Optional[StrictStr] = Field(default=None, description="For internal use by Voucherify.") + start_date: Optional[StrictStr] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.") + expiration_date: Optional[StrictStr] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.") + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule") + __properties: ClassVar[List[str]] = ["id", "created_at", "loyalty", "event", "custom_event", "segment", "loyalty_tier", "source", "object", "automation_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata", "validation_rule_id", "updated_at", "active"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule']): + raise ValueError("must be one of enum values ('earning_rule')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRule 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if automation_id (nullable) is None + # and model_fields_set contains the field + if self.automation_id is None and "automation_id" in self.model_fields_set: + _dict['automation_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRule 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"), + "created_at": obj.get("created_at"), + "loyalty": EarningRuleLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "event": obj.get("event"), + "custom_event": EarningRuleCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "segment": EarningRuleSegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": EarningRuleLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "source": EarningRuleSource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'earning_rule', + "automation_id": obj.get("automation_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata"), + "validation_rule_id": obj.get("validation_rule_id"), + "updated_at": obj.get("updated_at"), + "active": obj.get("active") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_custom_event.py b/voucherify/models/earning_rule_custom_event.py new file mode 100644 index 00000000..eefc9f10 --- /dev/null +++ b/voucherify/models/earning_rule_custom_event.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleCustomEvent(BaseModel): + """ + Contains details about the custom event. + """ # noqa: E501 + schema_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the custom event schema") + __properties: ClassVar[List[str]] = ["schema_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleCustomEvent 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, + ) + # set to None if schema_id (nullable) is None + # and model_fields_set contains the field + if self.schema_id is None and "schema_id" in self.model_fields_set: + _dict['schema_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "schema_id": obj.get("schema_id") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty.py b/voucherify/models/earning_rule_loyalty.py new file mode 100644 index 00000000..77e40ebf --- /dev/null +++ b/voucherify/models/earning_rule_loyalty.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.earning_rule_loyalty_custom_event import EarningRuleLoyaltyCustomEvent +from voucherify.models.earning_rule_loyalty_customer import EarningRuleLoyaltyCustomer +from voucherify.models.earning_rule_loyalty_order import EarningRuleLoyaltyOrder +from voucherify.models.earning_rule_loyalty_order_items import EarningRuleLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyalty(BaseModel): + """ + EarningRuleLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + calculation_type: Optional[StrictStr] = None + order: Optional[EarningRuleLoyaltyOrder] = None + order_items: Optional[EarningRuleLoyaltyOrderItems] = None + customer: Optional[EarningRuleLoyaltyCustomer] = None + custom_event: Optional[EarningRuleLoyaltyCustomEvent] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + __properties: ClassVar[List[str]] = ["type", "calculation_type", "order", "order_items", "customer", "custom_event", "points"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PROPORTIONAL', 'FIXED']): + raise ValueError("must be one of enum values ('PROPORTIONAL', 'FIXED')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA']): + raise ValueError("must be one of enum values ('ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyalty 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if calculation_type (nullable) is None + # and model_fields_set contains the field + if self.calculation_type is None and "calculation_type" in self.model_fields_set: + _dict['calculation_type'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if order_items (nullable) is None + # and model_fields_set contains the field + if self.order_items is None and "order_items" in self.model_fields_set: + _dict['order_items'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "calculation_type": obj.get("calculation_type"), + "order": EarningRuleLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "order_items": EarningRuleLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "customer": EarningRuleLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "custom_event": EarningRuleLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_custom_event.py b/voucherify/models/earning_rule_loyalty_custom_event.py new file mode 100644 index 00000000..d8dee217 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.earning_rule_loyalty_custom_event_metadata import EarningRuleLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyCustomEvent(BaseModel): + """ + EarningRuleLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[EarningRuleLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": EarningRuleLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_custom_event_metadata.py b/voucherify/models/earning_rule_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..48cefe0a --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_customer.py b/voucherify/models/earning_rule_loyalty_customer.py new file mode 100644 index 00000000..c34bcfbb --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.earning_rule_loyalty_customer_metadata import EarningRuleLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyCustomer(BaseModel): + """ + EarningRuleLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[EarningRuleLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": EarningRuleLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_customer_metadata.py b/voucherify/models/earning_rule_loyalty_customer_metadata.py new file mode 100644 index 00000000..be898561 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order.py b/voucherify/models/earning_rule_loyalty_order.py new file mode 100644 index 00000000..37332bf6 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.earning_rule_loyalty_order_amount import EarningRuleLoyaltyOrderAmount +from voucherify.models.earning_rule_loyalty_order_metadata import EarningRuleLoyaltyOrderMetadata +from voucherify.models.earning_rule_loyalty_order_total_amount import EarningRuleLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyOrder(BaseModel): + """ + EarningRuleLoyaltyOrder + """ # noqa: E501 + amount: Optional[EarningRuleLoyaltyOrderAmount] = None + total_amount: Optional[EarningRuleLoyaltyOrderTotalAmount] = None + metadata: Optional[EarningRuleLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": EarningRuleLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": EarningRuleLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": EarningRuleLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order_amount.py b/voucherify/models/earning_rule_loyalty_order_amount.py new file mode 100644 index 00000000..3bfb7a4e --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order_items.py b/voucherify/models/earning_rule_loyalty_order_items.py new file mode 100644 index 00000000..df7ffade --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.earning_rule_loyalty_order_items_amount import EarningRuleLoyaltyOrderItemsAmount +from voucherify.models.earning_rule_loyalty_order_items_quantity import EarningRuleLoyaltyOrderItemsQuantity +from voucherify.models.earning_rule_loyalty_order_items_subtotal_amount import EarningRuleLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyOrderItems(BaseModel): + """ + EarningRuleLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[EarningRuleLoyaltyOrderItemsQuantity] = None + amount: Optional[EarningRuleLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[EarningRuleLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": EarningRuleLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": EarningRuleLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": EarningRuleLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order_items_amount.py b/voucherify/models/earning_rule_loyalty_order_items_amount.py new file mode 100644 index 00000000..a8410b20 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class EarningRuleLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order_items_quantity.py b/voucherify/models/earning_rule_loyalty_order_items_quantity.py new file mode 100644 index 00000000..887c858d --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class EarningRuleLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order_items_subtotal_amount.py b/voucherify/models/earning_rule_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..994b8038 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class EarningRuleLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order_metadata.py b/voucherify/models/earning_rule_loyalty_order_metadata.py new file mode 100644 index 00000000..ad196fc0 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_order_total_amount.py b/voucherify/models/earning_rule_loyalty_order_total_amount.py new file mode 100644 index 00000000..7147c016 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_loyalty_tier.py b/voucherify/models/earning_rule_loyalty_tier.py new file mode 100644 index 00000000..6c761a27 --- /dev/null +++ b/voucherify/models/earning_rule_loyalty_tier.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleLoyaltyTier(BaseModel): + """ + Defines the tier associated with the earning rule definition. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleLoyaltyTier 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") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_segment.py b/voucherify/models/earning_rule_segment.py new file mode 100644 index 00000000..aefdc0c2 --- /dev/null +++ b/voucherify/models/earning_rule_segment.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EarningRuleSegment(BaseModel): + """ + Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a customer segment. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleSegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleSegment 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") + }) + return _obj + + diff --git a/voucherify/models/earning_rule_source.py b/voucherify/models/earning_rule_source.py new file mode 100644 index 00000000..0848f1d2 --- /dev/null +++ b/voucherify/models/earning_rule_source.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class EarningRuleSource(BaseModel): + """ + Contains the custom earning rule name and parent campaign. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + object_id: Optional[StrictStr] = Field(default=None, description="A unique campaign identifier assigned by the Voucherify API.") + object_type: Optional[StrictStr] = Field(default='campaign', description="Defines the object associated with the earning rule. Defaults to `campaign`.") + __properties: ClassVar[List[str]] = ["banner", "object_id", "object_type"] + + @field_validator('object_type') + def object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EarningRuleSource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if object_id (nullable) is None + # and model_fields_set contains the field + if self.object_id is None and "object_id" in self.model_fields_set: + _dict['object_id'] = None + + # set to None if object_type (nullable) is None + # and model_fields_set contains the field + if self.object_type is None and "object_type" in self.model_fields_set: + _dict['object_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EarningRuleSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner"), + "object_id": obj.get("object_id"), + "object_type": obj.get("object_type") if obj.get("object_type") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/error.py b/voucherify/models/error.py new file mode 100644 index 00000000..fb525da7 --- /dev/null +++ b/voucherify/models/error.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Error(BaseModel): + """ + Error details + """ # noqa: E501 + code: Optional[StrictInt] = Field(default=None, description="Error's HTTP status code.") + key: Optional[StrictStr] = Field(default=None, description="Short string describing the kind of error which occurred.") + message: Optional[StrictStr] = Field(default=None, description="A human-readable message providing a short description of the error.") + details: Optional[StrictStr] = Field(default=None, description="A human-readable message providing more details about the error.") + request_id: Optional[StrictStr] = Field(default=None, description="This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team.") + resource_id: Optional[StrictStr] = Field(default=None, description="Unique resource ID that can be used in another endpoint to get more details.") + resource_type: Optional[StrictStr] = Field(default=None, description="The resource type.") + __properties: ClassVar[List[str]] = ["code", "key", "message", "details", "request_id", "resource_id", "resource_type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error 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, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if key (nullable) is None + # and model_fields_set contains the field + if self.key is None and "key" in self.model_fields_set: + _dict['key'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + # set to None if details (nullable) is None + # and model_fields_set contains the field + if self.details is None and "details" in self.model_fields_set: + _dict['details'] = None + + # set to None if request_id (nullable) is None + # and model_fields_set contains the field + if self.request_id is None and "request_id" in self.model_fields_set: + _dict['request_id'] = None + + # set to None if resource_id (nullable) is None + # and model_fields_set contains the field + if self.resource_id is None and "resource_id" in self.model_fields_set: + _dict['resource_id'] = None + + # set to None if resource_type (nullable) is None + # and model_fields_set contains the field + if self.resource_type is None and "resource_type" in self.model_fields_set: + _dict['resource_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "key": obj.get("key"), + "message": obj.get("message"), + "details": obj.get("details"), + "request_id": obj.get("request_id"), + "resource_id": obj.get("resource_id"), + "resource_type": obj.get("resource_type") + }) + return _obj + + diff --git a/voucherify/models/events_create_request_body.py b/voucherify/models/events_create_request_body.py new file mode 100644 index 00000000..d5933321 --- /dev/null +++ b/voucherify/models/events_create_request_body.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.customer import Customer +from voucherify.models.events_create_request_body_loyalty import EventsCreateRequestBodyLoyalty +from voucherify.models.events_create_request_body_referral import EventsCreateRequestBodyReferral +from typing import Optional, Set +from typing_extensions import Self + +class EventsCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/events`. + """ # noqa: E501 + event: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = Field(default=None, description="Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**.") + customer: Customer + referral: Optional[EventsCreateRequestBodyReferral] = None + loyalty: Optional[EventsCreateRequestBodyLoyalty] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**.") + __properties: ClassVar[List[str]] = ["event", "customer", "referral", "loyalty", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EventsCreateRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referral + if self.referral: + _dict['referral'] = self.referral.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if event (nullable) is None + # and model_fields_set contains the field + if self.event is None and "event" in self.model_fields_set: + _dict['event'] = None + + # set to None if referral (nullable) is None + # and model_fields_set contains the field + if self.referral is None and "referral" in self.model_fields_set: + _dict['referral'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EventsCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "event": obj.get("event"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referral": EventsCreateRequestBodyReferral.from_dict(obj["referral"]) if obj.get("referral") is not None else None, + "loyalty": EventsCreateRequestBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/events_create_request_body_loyalty.py b/voucherify/models/events_create_request_body_loyalty.py new file mode 100644 index 00000000..baa8c9f6 --- /dev/null +++ b/voucherify/models/events_create_request_body_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EventsCreateRequestBodyLoyalty(BaseModel): + """ + If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to. + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code.") + __properties: ClassVar[List[str]] = ["code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EventsCreateRequestBodyLoyalty 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, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EventsCreateRequestBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code") + }) + return _obj + + diff --git a/voucherify/models/events_create_request_body_referral.py b/voucherify/models/events_create_request_body_referral.py new file mode 100644 index 00000000..e895b306 --- /dev/null +++ b/voucherify/models/events_create_request_body_referral.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class EventsCreateRequestBodyReferral(BaseModel): + """ + If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="A code through which a new visitor has been referred to a service.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique ID of the referring person - it is optional and not required if the referral **code** is provided.") + __properties: ClassVar[List[str]] = ["code", "referrer_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EventsCreateRequestBodyReferral 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, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EventsCreateRequestBodyReferral from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "referrer_id": obj.get("referrer_id") + }) + return _obj + + diff --git a/voucherify/models/events_create_response_body.py b/voucherify/models/events_create_response_body.py new file mode 100644 index 00000000..27fa0eb1 --- /dev/null +++ b/voucherify/models/events_create_response_body.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.simple_customer_required_object_type import SimpleCustomerRequiredObjectType +from typing import Optional, Set +from typing_extensions import Self + +class EventsCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/events`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='event', description="The object represented is an `event`.") + type: Optional[StrictStr] = Field(default=None, description="The event name.") + customer: SimpleCustomerRequiredObjectType + referral: Optional[Dict[str, Any]] = Field(default=None, description="A `null` referral object.") + loyalty: Optional[Dict[str, Any]] = Field(default=None, description="A `null` loyalty object.") + metadata: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["object", "type", "customer", "referral", "loyalty", "metadata"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['event']): + raise ValueError("must be one of enum values ('event')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EventsCreateResponseBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if referral (nullable) is None + # and model_fields_set contains the field + if self.referral is None and "referral" in self.model_fields_set: + _dict['referral'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EventsCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'event', + "type": obj.get("type"), + "customer": SimpleCustomerRequiredObjectType.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referral": obj.get("referral"), + "loyalty": obj.get("loyalty"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/export.py b/voucherify/models/export.py new file mode 100644 index 00000000..cc55557c --- /dev/null +++ b/voucherify/models/export.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.export_parameters import ExportParameters +from voucherify.models.export_result import ExportResult +from typing import Optional, Set +from typing_extensions import Self + +class Export(BaseModel): + """ + Export + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique export ID.") + object: Optional[StrictStr] = Field(default='export', description="The type of object being represented. This object stores information about the export.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the export was scheduled in ISO 8601 format.") + status: Optional[StrictStr] = Field(default=None, description="Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.") + channel: Optional[StrictStr] = Field(default=None, description="The channel through which the export was triggered.") + result: Optional[ExportResult] = None + user_id: Optional[StrictStr] = Field(default=None, description="Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.") + exported_object: Optional[StrictStr] = None + parameters: Optional[ExportParameters] = None + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "status", "channel", "result", "user_id", "exported_object", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['export']): + raise ValueError("must be one of enum values ('export')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SCHEDULED', 'IN_PROGRESS', 'DONE', 'ERROR']): + raise ValueError("must be one of enum values ('SCHEDULED', 'IN_PROGRESS', 'DONE', 'ERROR')") + return value + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions']): + raise ValueError("must be one of enum values ('voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Export 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 result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Export 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"), + "object": obj.get("object") if obj.get("object") is not None else 'export', + "created_at": obj.get("created_at"), + "status": obj.get("status"), + "channel": obj.get("channel"), + "result": ExportResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "user_id": obj.get("user_id"), + "exported_object": obj.get("exported_object"), + "parameters": ExportParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/export_order_fields.py b/voucherify/models/export_order_fields.py new file mode 100644 index 00000000..c4ae45a2 --- /dev/null +++ b/voucherify/models/export_order_fields.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ExportOrderFields(str, Enum): + """ + ExportOrderFields + """ + + """ + allowed enum values + """ + ID = 'id' + SOURCE_ID = 'source_id' + CREATED_AT = 'created_at' + UPDATED_AT = 'updated_at' + STATUS = 'status' + AMOUNT = 'amount' + DISCOUNT_AMOUNT = 'discount_amount' + ITEMS_DISCOUNT_AMOUNT = 'items_discount_amount' + TOTAL_DISCOUNT_AMOUNT = 'total_discount_amount' + TOTAL_AMOUNT = 'total_amount' + CUSTOMER_ID = 'customer_id' + REFERRER_ID = 'referrer_id' + METADATA = 'metadata' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ExportOrderFields from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/export_order_order.py b/voucherify/models/export_order_order.py new file mode 100644 index 00000000..3a1e19bf --- /dev/null +++ b/voucherify/models/export_order_order.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ExportOrderOrder(str, Enum): + """ + ExportOrderOrder + """ + + """ + allowed enum values + """ + MINUS_CREATED_AT = '-created_at' + CREATED_AT = 'created_at' + MINUS_UPDATED_AT = '-updated_at' + UPDATED_AT = 'updated_at' + MINUS_STATUS = '-status' + STATUS = 'status' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ExportOrderOrder from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/export_parameters.py b/voucherify/models/export_parameters.py new file mode 100644 index 00000000..15580266 --- /dev/null +++ b/voucherify/models/export_parameters.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.export_parameters_filters import ExportParametersFilters +from typing import Optional, Set +from typing_extensions import Self + +class ExportParameters(BaseModel): + """ + ExportParameters + """ # noqa: E501 + order: Optional[StrictStr] = None + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[ExportParametersFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id']): + raise ValueError("must be one of enum values ('-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details']): + raise ValueError("each list item must be one of ('code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + # set to None if filters (nullable) is None + # and model_fields_set contains the field + if self.filters is None and "filters" in self.model_fields_set: + _dict['filters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": ExportParametersFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/export_parameters_filters.py b/voucherify/models/export_parameters_filters.py new file mode 100644 index 00000000..14220c2a --- /dev/null +++ b/voucherify/models/export_parameters_filters.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ExportParametersFilters(BaseModel): + """ + ExportParametersFilters + """ # noqa: E501 + junction: Optional[Junction] = None + campaign_id: Optional[FieldConditions] = None + voucher_id: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "campaign_id", "voucher_id", "created_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportParametersFilters 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 campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportParametersFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "campaign_id": FieldConditions.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None, + "voucher_id": FieldConditions.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/export_result.py b/voucherify/models/export_result.py new file mode 100644 index 00000000..68dfc2d3 --- /dev/null +++ b/voucherify/models/export_result.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ExportResult(BaseModel): + """ + ExportResult + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="URL of the CSV file location. It contains the token used for authorization in the Download export method.") + __properties: ClassVar[List[str]] = ["url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportResult 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, + ) + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/export_voucher_transactions_fields.py b/voucherify/models/export_voucher_transactions_fields.py new file mode 100644 index 00000000..de805ef8 --- /dev/null +++ b/voucherify/models/export_voucher_transactions_fields.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ExportVoucherTransactionsFields(str, Enum): + """ + ExportVoucherTransactionsFields + """ + + """ + allowed enum values + """ + ID = 'id' + CAMPAIGN_ID = 'campaign_id' + VOUCHER_ID = 'voucher_id' + TYPE = 'type' + SOURCE_ID = 'source_id' + REASON = 'reason' + SOURCE = 'source' + BALANCE = 'balance' + AMOUNT = 'amount' + RELATED_TRANSACTION_ID = 'related_transaction_id' + CREATED_AT = 'created_at' + DETAILS = 'details' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ExportVoucherTransactionsFields from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/export_voucher_transactions_filters.py b/voucherify/models/export_voucher_transactions_filters.py new file mode 100644 index 00000000..291d2a71 --- /dev/null +++ b/voucherify/models/export_voucher_transactions_filters.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ExportVoucherTransactionsFilters(BaseModel): + """ + ExportVoucherTransactionsFilters + """ # noqa: E501 + junction: Optional[Junction] = None + created_at: Optional[FieldConditions] = None + voucher_id: Optional[FieldConditions] = None + campaign_id: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "created_at", "voucher_id", "campaign_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportVoucherTransactionsFilters 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 created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportVoucherTransactionsFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None, + "voucher_id": FieldConditions.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None, + "campaign_id": FieldConditions.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None + }) + return _obj + + diff --git a/voucherify/models/export_voucher_transactions_order.py b/voucherify/models/export_voucher_transactions_order.py new file mode 100644 index 00000000..607b2fb6 --- /dev/null +++ b/voucherify/models/export_voucher_transactions_order.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ExportVoucherTransactionsOrder(str, Enum): + """ + ExportVoucherTransactionsOrder + """ + + """ + allowed enum values + """ + MINUS_CREATED_AT = '-created_at' + CREATED_AT = 'created_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ExportVoucherTransactionsOrder from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/exports_create_request_body.py b/voucherify/models/exports_create_request_body.py new file mode 100644 index 00000000..84e0ac75 --- /dev/null +++ b/voucherify/models/exports_create_request_body.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.exports_create_request_body_parameters import ExportsCreateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class ExportsCreateRequestBody(BaseModel): + """ + ExportsCreateRequestBody + """ # noqa: E501 + exported_object: Optional[StrictStr] = None + parameters: Optional[ExportsCreateRequestBodyParameters] = None + __properties: ClassVar[List[str]] = ["exported_object", "parameters"] + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions']): + raise ValueError("must be one of enum values ('voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsCreateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "exported_object": obj.get("exported_object"), + "parameters": ExportsCreateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_create_request_body_parameters.py b/voucherify/models/exports_create_request_body_parameters.py new file mode 100644 index 00000000..e902d4c9 --- /dev/null +++ b/voucherify/models/exports_create_request_body_parameters.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.exports_create_request_body_parameters_filters import ExportsCreateRequestBodyParametersFilters +from typing import Optional, Set +from typing_extensions import Self + +class ExportsCreateRequestBodyParameters(BaseModel): + """ + ExportsCreateRequestBodyParameters + """ # noqa: E501 + order: Optional[StrictStr] = None + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[ExportsCreateRequestBodyParametersFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id']): + raise ValueError("must be one of enum values ('-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details']): + raise ValueError("each list item must be one of ('code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsCreateRequestBodyParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + # set to None if filters (nullable) is None + # and model_fields_set contains the field + if self.filters is None and "filters" in self.model_fields_set: + _dict['filters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsCreateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": ExportsCreateRequestBodyParametersFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_create_request_body_parameters_filters.py b/voucherify/models/exports_create_request_body_parameters_filters.py new file mode 100644 index 00000000..4f6858f7 --- /dev/null +++ b/voucherify/models/exports_create_request_body_parameters_filters.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ExportsCreateRequestBodyParametersFilters(BaseModel): + """ + ExportsCreateRequestBodyParametersFilters + """ # noqa: E501 + junction: Optional[Junction] = None + campaign_id: Optional[FieldConditions] = None + voucher_id: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "campaign_id", "voucher_id", "created_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsCreateRequestBodyParametersFilters 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 campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsCreateRequestBodyParametersFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "campaign_id": FieldConditions.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None, + "voucher_id": FieldConditions.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_create_response_body.py b/voucherify/models/exports_create_response_body.py new file mode 100644 index 00000000..fb575f2a --- /dev/null +++ b/voucherify/models/exports_create_response_body.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.exports_create_response_body_parameters import ExportsCreateResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class ExportsCreateResponseBody(BaseModel): + """ + ExportsCreateResponseBody + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique export ID.") + object: Optional[StrictStr] = Field(default='export', description="The type of object being represented. This object stores information about the export.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the export was scheduled in ISO 8601 format.") + status: Optional[StrictStr] = Field(default='SCHEDULED', description="Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.") + channel: Optional[StrictStr] = Field(default=None, description="The channel through which the export was triggered.") + result: Optional[Dict[str, Any]] = Field(default=None, description="Contains the URL of the CSV file.") + user_id: Optional[StrictStr] = Field(default=None, description="Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.") + exported_object: Optional[StrictStr] = None + parameters: Optional[ExportsCreateResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "status", "channel", "result", "user_id", "exported_object", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['export']): + raise ValueError("must be one of enum values ('export')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SCHEDULED']): + raise ValueError("must be one of enum values ('SCHEDULED')") + return value + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions']): + raise ValueError("must be one of enum values ('voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsCreateResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsCreateResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'export', + "created_at": obj.get("created_at"), + "status": obj.get("status") if obj.get("status") is not None else 'SCHEDULED', + "channel": obj.get("channel"), + "result": obj.get("result"), + "user_id": obj.get("user_id"), + "exported_object": obj.get("exported_object"), + "parameters": ExportsCreateResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_create_response_body_parameters.py b/voucherify/models/exports_create_response_body_parameters.py new file mode 100644 index 00000000..d72192dc --- /dev/null +++ b/voucherify/models/exports_create_response_body_parameters.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.exports_create_response_body_parameters_filters import ExportsCreateResponseBodyParametersFilters +from typing import Optional, Set +from typing_extensions import Self + +class ExportsCreateResponseBodyParameters(BaseModel): + """ + ExportsCreateResponseBodyParameters + """ # noqa: E501 + order: Optional[StrictStr] = None + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[ExportsCreateResponseBodyParametersFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id']): + raise ValueError("must be one of enum values ('-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details']): + raise ValueError("each list item must be one of ('code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsCreateResponseBodyParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + # set to None if filters (nullable) is None + # and model_fields_set contains the field + if self.filters is None and "filters" in self.model_fields_set: + _dict['filters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsCreateResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": ExportsCreateResponseBodyParametersFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_create_response_body_parameters_filters.py b/voucherify/models/exports_create_response_body_parameters_filters.py new file mode 100644 index 00000000..16276968 --- /dev/null +++ b/voucherify/models/exports_create_response_body_parameters_filters.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ExportsCreateResponseBodyParametersFilters(BaseModel): + """ + ExportsCreateResponseBodyParametersFilters + """ # noqa: E501 + junction: Optional[Junction] = None + campaign_id: Optional[FieldConditions] = None + voucher_id: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "campaign_id", "voucher_id", "created_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsCreateResponseBodyParametersFilters 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 campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsCreateResponseBodyParametersFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "campaign_id": FieldConditions.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None, + "voucher_id": FieldConditions.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_get_response_body.py b/voucherify/models/exports_get_response_body.py new file mode 100644 index 00000000..e3a30acf --- /dev/null +++ b/voucherify/models/exports_get_response_body.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.exports_get_response_body_parameters import ExportsGetResponseBodyParameters +from voucherify.models.exports_get_response_body_result import ExportsGetResponseBodyResult +from typing import Optional, Set +from typing_extensions import Self + +class ExportsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/exports/{exportId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique export ID.") + object: Optional[StrictStr] = Field(default='export', description="The type of object being represented. This object stores information about the export.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the export was scheduled in ISO 8601 format.") + status: Optional[StrictStr] = Field(default=None, description="Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.") + channel: Optional[StrictStr] = Field(default=None, description="The channel through which the export was triggered.") + result: Optional[ExportsGetResponseBodyResult] = None + user_id: Optional[StrictStr] = Field(default=None, description="Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.") + exported_object: Optional[StrictStr] = None + parameters: Optional[ExportsGetResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "status", "channel", "result", "user_id", "exported_object", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['export']): + raise ValueError("must be one of enum values ('export')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SCHEDULED', 'IN_PROGRESS', 'DONE', 'ERROR']): + raise ValueError("must be one of enum values ('SCHEDULED', 'IN_PROGRESS', 'DONE', 'ERROR')") + return value + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions']): + raise ValueError("must be one of enum values ('voucher', 'redemption', 'customer', 'publication', 'order', 'points_expiration', 'voucher_transactions')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsGetResponseBody 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 result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsGetResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'export', + "created_at": obj.get("created_at"), + "status": obj.get("status"), + "channel": obj.get("channel"), + "result": ExportsGetResponseBodyResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "user_id": obj.get("user_id"), + "exported_object": obj.get("exported_object"), + "parameters": ExportsGetResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_get_response_body_parameters.py b/voucherify/models/exports_get_response_body_parameters.py new file mode 100644 index 00000000..d7f1532d --- /dev/null +++ b/voucherify/models/exports_get_response_body_parameters.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.exports_get_response_body_parameters_filters import ExportsGetResponseBodyParametersFilters +from typing import Optional, Set +from typing_extensions import Self + +class ExportsGetResponseBodyParameters(BaseModel): + """ + ExportsGetResponseBodyParameters + """ # noqa: E501 + order: Optional[StrictStr] = None + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[ExportsGetResponseBodyParametersFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id']): + raise ValueError("must be one of enum values ('-created_at', 'created_at', '-updated_at', 'updated_at', '-code', 'code', '-id', 'id', '-voucher_code', 'voucher_code', '-tracking_id', 'tracking_id', '-customer_id', 'customer_id')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details']): + raise ValueError("each list item must be one of ('code', 'voucher_type', 'value', 'formula', 'discount_type', 'campaign', 'category', 'start_date', 'expiration_date', 'gift_balance', 'loyalty_balance', 'redemption_quantity', 'redemption_count', 'active', 'qr_code', 'bar_code', 'metadata', 'id', 'is_referral_code', 'created_at', 'updated_at', 'validity_timeframe_interval', 'validity_timeframe_duration', 'validity_day_of_week', 'discount_amount_limit', 'campaign_id', 'additional_info', 'customer_id', 'discount_effect', 'discount_unit_type', 'discount_unit_effect', 'validation_rules_id', 'customer_source_id', 'object', 'date', 'voucher_code', 'promotion_tier_id', 'customer_name', 'tracking_id', 'order_id', 'order_amount', 'gift_amount', 'loyalty_points', 'result', 'failure_code', 'failure_message', 'name', 'description', 'email', 'source_id', 'address_city', 'address_state', 'address_line_1', 'address_line_2', 'address_country', 'address_postal_code', 'redemptions_total_redeemed', 'redemptions_total_failed', 'redemptions_total_succeeded', 'redemptions_total_rolled_back', 'redemptions_total_rollback_failed', 'redemptions_total_rollback_succeeded', 'orders_total_amount', 'orders_total_count', 'orders_average_amount', 'orders_last_order_amount', 'orders_last_order_date', 'loyalty_referred_customers', 'phone', 'birthday', 'birthdate', 'channel', 'is_winner', 'status', 'amount', 'discount_amount', 'items_discount_amount', 'total_discount_amount', 'total_amount', 'referrer_id', 'voucher_id', 'points', 'expires_at', 'type', 'reason', 'source', 'balance', 'related_transaction_id', 'details')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsGetResponseBodyParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + # set to None if filters (nullable) is None + # and model_fields_set contains the field + if self.filters is None and "filters" in self.model_fields_set: + _dict['filters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsGetResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": ExportsGetResponseBodyParametersFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_get_response_body_parameters_filters.py b/voucherify/models/exports_get_response_body_parameters_filters.py new file mode 100644 index 00000000..b8d79185 --- /dev/null +++ b/voucherify/models/exports_get_response_body_parameters_filters.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ExportsGetResponseBodyParametersFilters(BaseModel): + """ + ExportsGetResponseBodyParametersFilters + """ # noqa: E501 + junction: Optional[Junction] = None + campaign_id: Optional[FieldConditions] = None + voucher_id: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "campaign_id", "voucher_id", "created_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsGetResponseBodyParametersFilters 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 campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsGetResponseBodyParametersFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "campaign_id": FieldConditions.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None, + "voucher_id": FieldConditions.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/exports_get_response_body_result.py b/voucherify/models/exports_get_response_body_result.py new file mode 100644 index 00000000..81d211f3 --- /dev/null +++ b/voucherify/models/exports_get_response_body_result.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ExportsGetResponseBodyResult(BaseModel): + """ + ExportsGetResponseBodyResult + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="URL of the CSV file location. It contains the token used for authorization in the Download export method.") + __properties: ClassVar[List[str]] = ["url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsGetResponseBodyResult 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, + ) + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsGetResponseBodyResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/exports_list_response_body.py b/voucherify/models/exports_list_response_body.py new file mode 100644 index 00000000..22c04006 --- /dev/null +++ b/voucherify/models/exports_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.export import Export +from typing import Optional, Set +from typing_extensions import Self + +class ExportsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/exports`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about exports.") + data_ref: Optional[StrictStr] = Field(default='exports', description="Identifies the name of the attribute that contains the array of exports.") + exports: Optional[List[Export]] = Field(default=None, description="An array of export objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of exports.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "exports", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['exports']): + raise ValueError("must be one of enum values ('exports')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportsListResponseBody 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 exports (list) + _items = [] + if self.exports: + for _item_exports in self.exports: + if _item_exports: + _items.append(_item_exports.to_dict()) + _dict['exports'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if exports (nullable) is None + # and model_fields_set contains the field + if self.exports is None and "exports" in self.model_fields_set: + _dict['exports'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'exports', + "exports": [Export.from_dict(_item) for _item in obj["exports"]] if obj.get("exports") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/field_conditions.py b/voucherify/models/field_conditions.py new file mode 100644 index 00000000..671af390 --- /dev/null +++ b/voucherify/models/field_conditions.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filters_condition import FiltersCondition +from typing import Optional, Set +from typing_extensions import Self + +class FieldConditions(BaseModel): + """ + FieldConditions + """ # noqa: E501 + conditions: Optional[FiltersCondition] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FieldConditions 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FieldConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FiltersCondition.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/filter_conditions_string.py b/voucherify/models/filter_conditions_string.py new file mode 100644 index 00000000..7b2127ce --- /dev/null +++ b/voucherify/models/filter_conditions_string.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class FilterConditionsString(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Value is exactly this value (single value).", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results omit this value (single value).", alias="$is_not") + has_value: Optional[StrictStr] = Field(default=None, description="Value is NOT null. The value for this parameter is an empty string.", alias="$has_value") + is_unknown: Optional[StrictStr] = Field(default=None, description="Value is null. The value for this parameter is an empty string.", alias="$is_unknown") + starts_with: Optional[StrictStr] = Field(default=None, description="Value starts with the specified string.", alias="$starts_with") + ends_with: Optional[StrictStr] = Field(default=None, description="Value ends with the specified string.", alias="$ends_with") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not", "$has_value", "$is_unknown", "$starts_with", "$ends_with"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FilterConditionsString 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if starts_with (nullable) is None + # and model_fields_set contains the field + if self.starts_with is None and "starts_with" in self.model_fields_set: + _dict['$starts_with'] = None + + # set to None if ends_with (nullable) is None + # and model_fields_set contains the field + if self.ends_with is None and "ends_with" in self.model_fields_set: + _dict['$ends_with'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FilterConditionsString from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "$starts_with": obj.get("$starts_with"), + "$ends_with": obj.get("$ends_with") + }) + return _obj + + diff --git a/voucherify/models/filters_condition.py b/voucherify/models/filters_condition.py new file mode 100644 index 00000000..918fd632 --- /dev/null +++ b/voucherify/models/filters_condition.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class FiltersCondition(BaseModel): + """ + FiltersCondition + """ # noqa: E501 + var_in: Optional[Any] = Field(default=None, alias="$in") + not_in: Optional[Any] = Field(default=None, alias="$not_in") + var_is: Optional[Any] = Field(default=None, alias="$is") + is_days_ago: Optional[Any] = Field(default=None, alias="$is_days_ago") + is_days_in_future: Optional[Any] = Field(default=None, alias="$is_days_in_future") + is_not: Optional[Any] = Field(default=None, alias="$is_not") + has_value: Optional[Any] = Field(default=None, alias="$has_value") + is_unknown: Optional[Any] = Field(default=None, alias="$is_unknown") + contains: Optional[Any] = Field(default=None, alias="$contains") + not_contain: Optional[Any] = Field(default=None, alias="$not_contain") + starts_with: Optional[Any] = Field(default=None, alias="$starts_with") + ends_with: Optional[Any] = Field(default=None, alias="$ends_with") + more_than: Optional[Any] = Field(default=None, alias="$more_than") + less_than: Optional[Any] = Field(default=None, alias="$less_than") + more_than_ago: Optional[Any] = Field(default=None, alias="$more_than_ago") + less_than_ago: Optional[Any] = Field(default=None, alias="$less_than_ago") + more_than_future: Optional[Any] = Field(default=None, alias="$more_than_future") + less_than_future: Optional[Any] = Field(default=None, alias="$less_than_future") + more_than_equal: Optional[Any] = Field(default=None, alias="$more_than_equal") + less_than_equal: Optional[Any] = Field(default=None, alias="$less_than_equal") + after: Optional[Any] = Field(default=None, alias="$after") + before: Optional[Any] = Field(default=None, alias="$before") + count: Optional[Any] = Field(default=None, alias="$count") + count_less: Optional[Any] = Field(default=None, alias="$count_less") + count_more: Optional[Any] = Field(default=None, alias="$count_more") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_days_ago", "$is_days_in_future", "$is_not", "$has_value", "$is_unknown", "$contains", "$not_contain", "$starts_with", "$ends_with", "$more_than", "$less_than", "$more_than_ago", "$less_than_ago", "$more_than_future", "$less_than_future", "$more_than_equal", "$less_than_equal", "$after", "$before", "$count", "$count_less", "$count_more"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FiltersCondition 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_days_ago (nullable) is None + # and model_fields_set contains the field + if self.is_days_ago is None and "is_days_ago" in self.model_fields_set: + _dict['$is_days_ago'] = None + + # set to None if is_days_in_future (nullable) is None + # and model_fields_set contains the field + if self.is_days_in_future is None and "is_days_in_future" in self.model_fields_set: + _dict['$is_days_in_future'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if contains (nullable) is None + # and model_fields_set contains the field + if self.contains is None and "contains" in self.model_fields_set: + _dict['$contains'] = None + + # set to None if not_contain (nullable) is None + # and model_fields_set contains the field + if self.not_contain is None and "not_contain" in self.model_fields_set: + _dict['$not_contain'] = None + + # set to None if starts_with (nullable) is None + # and model_fields_set contains the field + if self.starts_with is None and "starts_with" in self.model_fields_set: + _dict['$starts_with'] = None + + # set to None if ends_with (nullable) is None + # and model_fields_set contains the field + if self.ends_with is None and "ends_with" in self.model_fields_set: + _dict['$ends_with'] = None + + # set to None if more_than (nullable) is None + # and model_fields_set contains the field + if self.more_than is None and "more_than" in self.model_fields_set: + _dict['$more_than'] = None + + # set to None if less_than (nullable) is None + # and model_fields_set contains the field + if self.less_than is None and "less_than" in self.model_fields_set: + _dict['$less_than'] = None + + # set to None if more_than_ago (nullable) is None + # and model_fields_set contains the field + if self.more_than_ago is None and "more_than_ago" in self.model_fields_set: + _dict['$more_than_ago'] = None + + # set to None if less_than_ago (nullable) is None + # and model_fields_set contains the field + if self.less_than_ago is None and "less_than_ago" in self.model_fields_set: + _dict['$less_than_ago'] = None + + # set to None if more_than_future (nullable) is None + # and model_fields_set contains the field + if self.more_than_future is None and "more_than_future" in self.model_fields_set: + _dict['$more_than_future'] = None + + # set to None if less_than_future (nullable) is None + # and model_fields_set contains the field + if self.less_than_future is None and "less_than_future" in self.model_fields_set: + _dict['$less_than_future'] = None + + # set to None if more_than_equal (nullable) is None + # and model_fields_set contains the field + if self.more_than_equal is None and "more_than_equal" in self.model_fields_set: + _dict['$more_than_equal'] = None + + # set to None if less_than_equal (nullable) is None + # and model_fields_set contains the field + if self.less_than_equal is None and "less_than_equal" in self.model_fields_set: + _dict['$less_than_equal'] = None + + # set to None if after (nullable) is None + # and model_fields_set contains the field + if self.after is None and "after" in self.model_fields_set: + _dict['$after'] = None + + # set to None if before (nullable) is None + # and model_fields_set contains the field + if self.before is None and "before" in self.model_fields_set: + _dict['$before'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['$count'] = None + + # set to None if count_less (nullable) is None + # and model_fields_set contains the field + if self.count_less is None and "count_less" in self.model_fields_set: + _dict['$count_less'] = None + + # set to None if count_more (nullable) is None + # and model_fields_set contains the field + if self.count_more is None and "count_more" in self.model_fields_set: + _dict['$count_more'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FiltersCondition from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_days_ago": obj.get("$is_days_ago"), + "$is_days_in_future": obj.get("$is_days_in_future"), + "$is_not": obj.get("$is_not"), + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "$contains": obj.get("$contains"), + "$not_contain": obj.get("$not_contain"), + "$starts_with": obj.get("$starts_with"), + "$ends_with": obj.get("$ends_with"), + "$more_than": obj.get("$more_than"), + "$less_than": obj.get("$less_than"), + "$more_than_ago": obj.get("$more_than_ago"), + "$less_than_ago": obj.get("$less_than_ago"), + "$more_than_future": obj.get("$more_than_future"), + "$less_than_future": obj.get("$less_than_future"), + "$more_than_equal": obj.get("$more_than_equal"), + "$less_than_equal": obj.get("$less_than_equal"), + "$after": obj.get("$after"), + "$before": obj.get("$before"), + "$count": obj.get("$count"), + "$count_less": obj.get("$count_less"), + "$count_more": obj.get("$count_more") + }) + return _obj + + diff --git a/voucherify/models/gift.py b/voucherify/models/gift.py new file mode 100644 index 00000000..e6fde5ac --- /dev/null +++ b/voucherify/models/gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class Gift(BaseModel): + """ + Contains current gift card balance information. + """ # noqa: E501 + amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Gift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Gift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/inapplicable_to.py b/voucherify/models/inapplicable_to.py new file mode 100644 index 00000000..2cd57563 --- /dev/null +++ b/voucherify/models/inapplicable_to.py @@ -0,0 +1,211 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from voucherify.models.applicable_to_effect import ApplicableToEffect +from typing import Optional, Set +from typing_extensions import Self + +class InapplicableTo(BaseModel): + """ + InapplicableTo + """ # noqa: E501 + object: Optional[StrictStr] = Field(default=None, description="This object stores information about the resource to which the discount is applicable.") + id: Optional[StrictStr] = Field(default=None, description="Unique product collection, product, or SKU identifier assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="The source identifier from your inventory system.") + product_id: Optional[StrictStr] = Field(default=None, description="Parent product's unique ID assigned by Voucherify.") + product_source_id: Optional[StrictStr] = Field(default=None, description="Parent product's source ID from your inventory system.") + strict: Optional[StrictBool] = None + price: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price.") + price_formula: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Formula used to calculate the discounted price of an item.") + effect: ApplicableToEffect + quantity_limit: Optional[StrictInt] = Field(default=None, description="The maximum number of units allowed to be discounted per order line item.") + aggregated_quantity_limit: Optional[StrictInt] = Field(default=None, description="The maximum number of units allowed to be discounted combined across all matched order line items.") + amount_limit: Optional[StrictInt] = Field(default=None, description="Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.") + aggregated_amount_limit: Optional[StrictInt] = Field(default=None, description="Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value)") + order_item_indices: Optional[List[StrictInt]] = Field(default=None, description="Determines the order in which the discount is applied to the products or SKUs sent in the `order` object in the request. The counting begins from `0`.") + repeat: Optional[StrictInt] = Field(default=None, description="Determines the recurrence of the discount, e.g. `\"repeat\": 3` means that the discount is applied to every third item.") + skip_initially: Optional[StrictInt] = Field(default=None, description="Determines how many items are skipped before the discount is applied.") + target: Optional[StrictStr] = Field(default=None, description="Determines to which kinds of objects the discount is applicable. `\"ITEM\"` includes products and SKUs.") + __properties: ClassVar[List[str]] = ["object", "id", "source_id", "product_id", "product_source_id", "strict", "price", "price_formula", "effect", "quantity_limit", "aggregated_quantity_limit", "amount_limit", "aggregated_amount_limit", "order_item_indices", "repeat", "skip_initially", "target"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product', 'sku', 'products_collection']): + raise ValueError("must be one of enum values ('product', 'sku', 'products_collection')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InapplicableTo 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if product_source_id (nullable) is None + # and model_fields_set contains the field + if self.product_source_id is None and "product_source_id" in self.model_fields_set: + _dict['product_source_id'] = None + + # set to None if strict (nullable) is None + # and model_fields_set contains the field + if self.strict is None and "strict" in self.model_fields_set: + _dict['strict'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if price_formula (nullable) is None + # and model_fields_set contains the field + if self.price_formula is None and "price_formula" in self.model_fields_set: + _dict['price_formula'] = None + + # set to None if quantity_limit (nullable) is None + # and model_fields_set contains the field + if self.quantity_limit is None and "quantity_limit" in self.model_fields_set: + _dict['quantity_limit'] = None + + # set to None if aggregated_quantity_limit (nullable) is None + # and model_fields_set contains the field + if self.aggregated_quantity_limit is None and "aggregated_quantity_limit" in self.model_fields_set: + _dict['aggregated_quantity_limit'] = None + + # set to None if amount_limit (nullable) is None + # and model_fields_set contains the field + if self.amount_limit is None and "amount_limit" in self.model_fields_set: + _dict['amount_limit'] = None + + # set to None if aggregated_amount_limit (nullable) is None + # and model_fields_set contains the field + if self.aggregated_amount_limit is None and "aggregated_amount_limit" in self.model_fields_set: + _dict['aggregated_amount_limit'] = None + + # set to None if order_item_indices (nullable) is None + # and model_fields_set contains the field + if self.order_item_indices is None and "order_item_indices" in self.model_fields_set: + _dict['order_item_indices'] = None + + # set to None if repeat (nullable) is None + # and model_fields_set contains the field + if self.repeat is None and "repeat" in self.model_fields_set: + _dict['repeat'] = None + + # set to None if skip_initially (nullable) is None + # and model_fields_set contains the field + if self.skip_initially is None and "skip_initially" in self.model_fields_set: + _dict['skip_initially'] = None + + # set to None if target (nullable) is None + # and model_fields_set contains the field + if self.target is None and "target" in self.model_fields_set: + _dict['target'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InapplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object"), + "id": obj.get("id"), + "source_id": obj.get("source_id"), + "product_id": obj.get("product_id"), + "product_source_id": obj.get("product_source_id"), + "strict": obj.get("strict"), + "price": obj.get("price"), + "price_formula": obj.get("price_formula"), + "effect": obj.get("effect"), + "quantity_limit": obj.get("quantity_limit"), + "aggregated_quantity_limit": obj.get("aggregated_quantity_limit"), + "amount_limit": obj.get("amount_limit"), + "aggregated_amount_limit": obj.get("aggregated_amount_limit"), + "order_item_indices": obj.get("order_item_indices"), + "repeat": obj.get("repeat"), + "skip_initially": obj.get("skip_initially"), + "target": obj.get("target") + }) + return _obj + + diff --git a/voucherify/models/inapplicable_to_result_list.py b/voucherify/models/inapplicable_to_result_list.py new file mode 100644 index 00000000..493c4d54 --- /dev/null +++ b/voucherify/models/inapplicable_to_result_list.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.inapplicable_to import InapplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class InapplicableToResultList(BaseModel): + """ + InapplicableToResultList + """ # noqa: E501 + data: Optional[List[InapplicableTo]] = Field(default=None, description="Contains array of items to which the discount cannot apply.") + total: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Total number of objects defining included products, SKUs, or product collections.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON.") + data_ref: Optional[StrictStr] = Field(default='data', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["data", "total", "object", "data_ref"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InapplicableToResultList 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InapplicableToResultList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "data": [InapplicableTo.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data' + }) + return _obj + + diff --git a/voucherify/models/junction.py b/voucherify/models/junction.py new file mode 100644 index 00000000..ab8fd07e --- /dev/null +++ b/voucherify/models/junction.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class Junction(str, Enum): + """ + Logical Operator Between Filters. Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE. + """ + + """ + allowed enum values + """ + AND = 'and' + OR = 'or' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Junction from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/list_publications_item_voucher.py b/voucherify/models/list_publications_item_voucher.py new file mode 100644 index 00000000..b8b2ff73 --- /dev/null +++ b/voucherify/models/list_publications_item_voucher.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from typing import Optional, Set +from typing_extensions import Self + +class ListPublicationsItemVoucher(BaseModel): + """ + ListPublicationsItemVoucher + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Voucher code.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON.") + campaign: Optional[StrictStr] = Field(default=None, description="Campaign name") + gift: Optional[Gift] = None + loyalty_card: Optional[Dict[str, Any]] = Field(default=None, description="Defines the loyalty card details.") + discount: Optional[Discount] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + __properties: ClassVar[List[str]] = ["code", "object", "campaign", "gift", "loyalty_card", "discount", "is_referral_code"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListPublicationsItemVoucher 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 gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListPublicationsItemVoucher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "campaign": obj.get("campaign"), + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": obj.get("loyalty_card"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "is_referral_code": obj.get("is_referral_code") + }) + return _obj + + diff --git a/voucherify/models/loyalties_create_campaign_request_body.py b/voucherify/models/loyalties_create_campaign_request_body.py new file mode 100644 index 00000000..0c85a9ba --- /dev/null +++ b/voucherify/models/loyalties_create_campaign_request_body.py @@ -0,0 +1,244 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.campaign_loyalty_voucher import CampaignLoyaltyVoucher +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesCreateCampaignRequestBody(BaseModel): + """ + Request body schema for **POST** `/loyalties`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign (size of campaign).") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + validation_rules: Optional[Annotated[List[StrictStr], Field(max_length=1)]] = Field(default=None, description="Array containing the ID of the validation rule associated with the promotion tier.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.") + category: Optional[StrictStr] = Field(default=None, description="The category assigned to the campaign. Either pass this parameter OR the `category_id`.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + campaign_type: Optional[StrictStr] = Field(default='LOYALTY_PROGRAM', description="Type of campaign.") + voucher: Optional[CampaignLoyaltyVoucher] = None + __properties: ClassVar[List[str]] = ["name", "description", "type", "join_once", "auto_join", "use_voucher_metadata_schema", "vouchers_count", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "validation_rules", "category_id", "category", "metadata", "campaign_type", "voucher"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesCreateCampaignRequestBody 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if validation_rules (nullable) is None + # and model_fields_set contains the field + if self.validation_rules is None and "validation_rules" in self.model_fields_set: + _dict['validation_rules'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesCreateCampaignRequestBody 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"), + "type": obj.get("type"), + "join_once": obj.get("join_once"), + "auto_join": obj.get("auto_join"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "validation_rules": obj.get("validation_rules"), + "category_id": obj.get("category_id"), + "category": obj.get("category"), + "metadata": obj.get("metadata"), + "campaign_type": obj.get("campaign_type") if obj.get("campaign_type") is not None else 'LOYALTY_PROGRAM', + "voucher": CampaignLoyaltyVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_create_campaign_response_body.py b/voucherify/models/loyalties_create_campaign_response_body.py new file mode 100644 index 00000000..db24e410 --- /dev/null +++ b/voucherify/models/loyalties_create_campaign_response_body.py @@ -0,0 +1,345 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.category import Category +from voucherify.models.loyalty_campaign_voucher import LoyaltyCampaignVoucher +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesCreateCampaignResponseBody(BaseModel): + """ + Response body schema for **POST** `/loyalties`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default='LOYALTY_PROGRAM', description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[LoyaltyCampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + access_settings_assignments: Optional[AccessSettingsCampaignAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "loyalty_tiers_expiration", "validation_rules_assignments", "access_settings_assignments"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesCreateCampaignResponseBody 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of access_settings_assignments + if self.access_settings_assignments: + _dict['access_settings_assignments'] = self.access_settings_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesCreateCampaignResponseBody 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type") if obj.get("campaign_type") is not None else 'LOYALTY_PROGRAM', + "type": obj.get("type"), + "voucher": LoyaltyCampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "access_settings_assignments": AccessSettingsCampaignAssignmentsList.from_dict(obj["access_settings_assignments"]) if obj.get("access_settings_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_delete_response_body.py b/voucherify/models/loyalties_delete_response_body.py new file mode 100644 index 00000000..e12be5b0 --- /dev/null +++ b/voucherify/models/loyalties_delete_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesDeleteResponseBody(BaseModel): + """ + Response body schema for **DELETE** `/loyalties/{campaignId}`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesDeleteResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesDeleteResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item.py b/voucherify/models/loyalties_earning_rules_create_request_body_item.py new file mode 100644 index 00000000..4ff815c0 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_request_body_item_custom_event import LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty import LoyaltiesEarningRulesCreateRequestBodyItemLoyalty +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_tier import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier +from voucherify.models.loyalties_earning_rules_create_request_body_item_segment import LoyaltiesEarningRulesCreateRequestBodyItemSegment +from voucherify.models.loyalties_earning_rules_create_request_body_item_source import LoyaltiesEarningRulesCreateRequestBodyItemSource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItem(BaseModel): + """ + LoyaltiesEarningRulesCreateRequestBodyItem + """ # noqa: E501 + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + loyalty: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyalty] = None + event: Optional[StrictStr] = None + source: Optional[LoyaltiesEarningRulesCreateRequestBodyItemSource] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule") + start_date: Optional[datetime] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = None + segment: Optional[LoyaltiesEarningRulesCreateRequestBodyItemSegment] = None + custom_event: Optional[LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent] = None + loyalty_tier: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier] = None + __properties: ClassVar[List[str]] = ["validation_rule_id", "loyalty", "event", "source", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata", "segment", "custom_event", "loyalty_tier"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItem 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "validation_rule_id": obj.get("validation_rule_id"), + "loyalty": LoyaltiesEarningRulesCreateRequestBodyItemLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "event": obj.get("event"), + "source": LoyaltiesEarningRulesCreateRequestBodyItemSource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata"), + "segment": LoyaltiesEarningRulesCreateRequestBodyItemSegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "custom_event": LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "loyalty_tier": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_custom_event.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_custom_event.py new file mode 100644 index 00000000..d4ce9d86 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_custom_event.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent(BaseModel): + """ + Contains the schema id of a custom event. **Required** for the custom event option in `event`. + """ # noqa: E501 + schema_id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["schema_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent 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, + ) + # set to None if schema_id (nullable) is None + # and model_fields_set contains the field + if self.schema_id is None and "schema_id" in self.model_fields_set: + _dict['schema_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "schema_id": obj.get("schema_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty.py new file mode 100644 index 00000000..8258d3a6 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_custom_event import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_customer import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyalty(BaseModel): + """ + LoyaltiesEarningRulesCreateRequestBodyItemLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + calculation_type: Optional[StrictStr] = None + custom_event: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent] = None + order_items: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems] = None + order: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder] = None + customer: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer] = None + __properties: ClassVar[List[str]] = ["type", "points", "calculation_type", "custom_event", "order_items", "order", "customer"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['FIXED', 'PROPORTIONAL']): + raise ValueError("must be one of enum values ('FIXED', 'PROPORTIONAL')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CUSTOM_EVENT_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'CUSTOMER_METADATA']): + raise ValueError("must be one of enum values ('CUSTOM_EVENT_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'CUSTOMER_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyalty 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 custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "points": obj.get("points"), + "calculation_type": obj.get("calculation_type"), + "custom_event": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "order_items": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "order": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "customer": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event.py new file mode 100644 index 00000000..f88afaa4 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent(BaseModel): + """ + LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..11771283 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_customer.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_customer.py new file mode 100644 index 00000000..65ca8606 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer(BaseModel): + """ + LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata.py new file mode 100644 index 00000000..b38dc0f7 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order.py new file mode 100644 index 00000000..a2ccb8c9 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_metadata import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder(BaseModel): + """ + LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder + """ # noqa: E501 + amount: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount] = None + total_amount: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount] = None + metadata: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_amount.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_amount.py new file mode 100644 index 00000000..f1d482f0 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items.py new file mode 100644 index 00000000..f6bd99a9 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems(BaseModel): + """ + LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity] = None + amount: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount.py new file mode 100644 index 00000000..ca11b605 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity.py new file mode 100644 index 00000000..42c9e99e --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..1402dbe5 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_metadata.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_metadata.py new file mode 100644 index 00000000..582fbd0d --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount.py new file mode 100644 index 00000000..1fa85740 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_tier.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_tier.py new file mode 100644 index 00000000..ccf34dba --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_loyalty_tier.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier(BaseModel): + """ + Defines the tier associated with the earning rule definition. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemLoyaltyTier 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_segment.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_segment.py new file mode 100644 index 00000000..79c742ab --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_segment.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemSegment(BaseModel): + """ + Contains the ID of a customer segment. **Required** for the `customer.segment.entered` option in `event`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a customer segment. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemSegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemSegment 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_request_body_item_source.py b/voucherify/models/loyalties_earning_rules_create_request_body_item_source.py new file mode 100644 index 00000000..a7413486 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_request_body_item_source.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateRequestBodyItemSource(BaseModel): + """ + LoyaltiesEarningRulesCreateRequestBodyItemSource + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + __properties: ClassVar[List[str]] = ["banner"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemSource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateRequestBodyItemSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body.py b/voucherify/models/loyalties_earning_rules_create_response_body.py new file mode 100644 index 00000000..3ccb9216 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_response_body_custom_event import LoyaltiesEarningRulesCreateResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty import LoyaltiesEarningRulesCreateResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_tier import LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_create_response_body_segment import LoyaltiesEarningRulesCreateResponseBodySegment +from voucherify.models.loyalties_earning_rules_create_response_body_source import LoyaltiesEarningRulesCreateResponseBodySource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the earning rule object.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.") + loyalty: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyalty] = None + event: Optional[StrictStr] = None + custom_event: Optional[LoyaltiesEarningRulesCreateResponseBodyCustomEvent] = None + segment: Optional[LoyaltiesEarningRulesCreateResponseBodySegment] = None + loyalty_tier: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier] = None + source: Optional[LoyaltiesEarningRulesCreateResponseBodySource] = None + object: Optional[StrictStr] = Field(default='earning_rule', description="The type of the object represented by JSON. Default is earning_rule.") + automation_id: Optional[StrictStr] = Field(default=None, description="For internal use by Voucherify.") + start_date: Optional[StrictStr] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.") + expiration_date: Optional[StrictStr] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.") + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule") + __properties: ClassVar[List[str]] = ["id", "created_at", "loyalty", "event", "custom_event", "segment", "loyalty_tier", "source", "object", "automation_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata", "validation_rule_id", "updated_at", "active"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule']): + raise ValueError("must be one of enum values ('earning_rule')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBody 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if automation_id (nullable) is None + # and model_fields_set contains the field + if self.automation_id is None and "automation_id" in self.model_fields_set: + _dict['automation_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBody 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"), + "created_at": obj.get("created_at"), + "loyalty": LoyaltiesEarningRulesCreateResponseBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "event": obj.get("event"), + "custom_event": LoyaltiesEarningRulesCreateResponseBodyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "segment": LoyaltiesEarningRulesCreateResponseBodySegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "source": LoyaltiesEarningRulesCreateResponseBodySource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'earning_rule', + "automation_id": obj.get("automation_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata"), + "validation_rule_id": obj.get("validation_rule_id"), + "updated_at": obj.get("updated_at"), + "active": obj.get("active") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_custom_event.py b/voucherify/models/loyalties_earning_rules_create_response_body_custom_event.py new file mode 100644 index 00000000..2830f622 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_custom_event.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyCustomEvent(BaseModel): + """ + Contains details about the custom event. + """ # noqa: E501 + schema_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the custom event schema") + __properties: ClassVar[List[str]] = ["schema_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyCustomEvent 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, + ) + # set to None if schema_id (nullable) is None + # and model_fields_set contains the field + if self.schema_id is None and "schema_id" in self.model_fields_set: + _dict['schema_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "schema_id": obj.get("schema_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty.py new file mode 100644 index 00000000..6e770e1f --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_earning_rules_create_response_body_loyalty_custom_event import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_customer import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyalty(BaseModel): + """ + LoyaltiesEarningRulesCreateResponseBodyLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + calculation_type: Optional[StrictStr] = None + order: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder] = None + order_items: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems] = None + customer: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer] = None + custom_event: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + __properties: ClassVar[List[str]] = ["type", "calculation_type", "order", "order_items", "customer", "custom_event", "points"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PROPORTIONAL', 'FIXED']): + raise ValueError("must be one of enum values ('PROPORTIONAL', 'FIXED')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA']): + raise ValueError("must be one of enum values ('ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyalty 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if calculation_type (nullable) is None + # and model_fields_set contains the field + if self.calculation_type is None and "calculation_type" in self.model_fields_set: + _dict['calculation_type'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if order_items (nullable) is None + # and model_fields_set contains the field + if self.order_items is None and "order_items" in self.model_fields_set: + _dict['order_items'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "calculation_type": obj.get("calculation_type"), + "order": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "order_items": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "customer": LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "custom_event": LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_custom_event.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_custom_event.py new file mode 100644 index 00000000..c7fc3cec --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent(BaseModel): + """ + LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..6d220bf7 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_customer.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_customer.py new file mode 100644 index 00000000..8ae87225 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer(BaseModel): + """ + LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_customer_metadata.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_customer_metadata.py new file mode 100644 index 00000000..65eb25f1 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order.py new file mode 100644 index 00000000..e57693b4 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_metadata import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder(BaseModel): + """ + LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder + """ # noqa: E501 + amount: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount] = None + total_amount: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount] = None + metadata: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_amount.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_amount.py new file mode 100644 index 00000000..281176eb --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items.py new file mode 100644 index 00000000..9718d12e --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems(BaseModel): + """ + LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity] = None + amount: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_amount.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_amount.py new file mode 100644 index 00000000..942c9481 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_quantity.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_quantity.py new file mode 100644 index 00000000..ebd14576 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..6e47e5d4 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_metadata.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_metadata.py new file mode 100644 index 00000000..7cc77fa4 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_total_amount.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_total_amount.py new file mode 100644 index 00000000..e8b3d1c5 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_tier.py b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_tier.py new file mode 100644 index 00000000..bce32268 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_loyalty_tier.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier(BaseModel): + """ + Defines the tier associated with the earning rule definition. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodyLoyaltyTier 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_segment.py b/voucherify/models/loyalties_earning_rules_create_response_body_segment.py new file mode 100644 index 00000000..67c05477 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_segment.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodySegment(BaseModel): + """ + Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a customer segment. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodySegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodySegment 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_create_response_body_source.py b/voucherify/models/loyalties_earning_rules_create_response_body_source.py new file mode 100644 index 00000000..811f35a3 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_create_response_body_source.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesCreateResponseBodySource(BaseModel): + """ + Contains the custom earning rule name and parent campaign. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + object_id: Optional[StrictStr] = Field(default=None, description="A unique campaign identifier assigned by the Voucherify API.") + object_type: Optional[StrictStr] = Field(default='campaign', description="Defines the object associated with the earning rule. Defaults to `campaign`.") + __properties: ClassVar[List[str]] = ["banner", "object_id", "object_type"] + + @field_validator('object_type') + def object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodySource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if object_id (nullable) is None + # and model_fields_set contains the field + if self.object_id is None and "object_id" in self.model_fields_set: + _dict['object_id'] = None + + # set to None if object_type (nullable) is None + # and model_fields_set contains the field + if self.object_type is None and "object_type" in self.model_fields_set: + _dict['object_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesCreateResponseBodySource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner"), + "object_id": obj.get("object_id"), + "object_type": obj.get("object_type") if obj.get("object_type") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body.py b/voucherify/models/loyalties_earning_rules_disable_response_body.py new file mode 100644 index 00000000..78550f4d --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body.py @@ -0,0 +1,242 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_disable_response_body_custom_event import LoyaltiesEarningRulesDisableResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty import LoyaltiesEarningRulesDisableResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_tier import LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_disable_response_body_segment import LoyaltiesEarningRulesDisableResponseBodySegment +from voucherify.models.loyalties_earning_rules_disable_response_body_source import LoyaltiesEarningRulesDisableResponseBodySource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable` + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the earning rule object.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.") + loyalty: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyalty] = None + event: Optional[StrictStr] = None + custom_event: Optional[LoyaltiesEarningRulesDisableResponseBodyCustomEvent] = None + segment: Optional[LoyaltiesEarningRulesDisableResponseBodySegment] = None + loyalty_tier: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier] = None + source: Optional[LoyaltiesEarningRulesDisableResponseBodySource] = None + object: Optional[StrictStr] = Field(default='earning_rule', description="The type of the object represented by JSON. Default is earning_rule.") + automation_id: Optional[StrictStr] = Field(default=None, description="For internal use by Voucherify.") + start_date: Optional[StrictStr] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.") + expiration_date: Optional[StrictStr] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.") + active: Optional[StrictBool] = Field(default=False, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.") + __properties: ClassVar[List[str]] = ["id", "created_at", "loyalty", "event", "custom_event", "segment", "loyalty_tier", "source", "object", "automation_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata", "updated_at", "active"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule']): + raise ValueError("must be one of enum values ('earning_rule')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBody 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if automation_id (nullable) is None + # and model_fields_set contains the field + if self.automation_id is None and "automation_id" in self.model_fields_set: + _dict['automation_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBody 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"), + "created_at": obj.get("created_at"), + "loyalty": LoyaltiesEarningRulesDisableResponseBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "event": obj.get("event"), + "custom_event": LoyaltiesEarningRulesDisableResponseBodyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "segment": LoyaltiesEarningRulesDisableResponseBodySegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "source": LoyaltiesEarningRulesDisableResponseBodySource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'earning_rule', + "automation_id": obj.get("automation_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata"), + "updated_at": obj.get("updated_at"), + "active": obj.get("active") if obj.get("active") is not None else False + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_custom_event.py b/voucherify/models/loyalties_earning_rules_disable_response_body_custom_event.py new file mode 100644 index 00000000..c5764c1d --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_custom_event.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyCustomEvent(BaseModel): + """ + Contains details about the custom event. + """ # noqa: E501 + schema_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the custom event schema") + __properties: ClassVar[List[str]] = ["schema_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyCustomEvent 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, + ) + # set to None if schema_id (nullable) is None + # and model_fields_set contains the field + if self.schema_id is None and "schema_id" in self.model_fields_set: + _dict['schema_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "schema_id": obj.get("schema_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty.py new file mode 100644 index 00000000..b4a2d727 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_custom_event import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_customer import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyalty(BaseModel): + """ + LoyaltiesEarningRulesDisableResponseBodyLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + calculation_type: Optional[StrictStr] = None + order: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder] = None + order_items: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems] = None + customer: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer] = None + custom_event: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + __properties: ClassVar[List[str]] = ["type", "calculation_type", "order", "order_items", "customer", "custom_event", "points"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PROPORTIONAL', 'FIXED']): + raise ValueError("must be one of enum values ('PROPORTIONAL', 'FIXED')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA']): + raise ValueError("must be one of enum values ('ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyalty 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if calculation_type (nullable) is None + # and model_fields_set contains the field + if self.calculation_type is None and "calculation_type" in self.model_fields_set: + _dict['calculation_type'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if order_items (nullable) is None + # and model_fields_set contains the field + if self.order_items is None and "order_items" in self.model_fields_set: + _dict['order_items'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "calculation_type": obj.get("calculation_type"), + "order": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "order_items": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "customer": LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "custom_event": LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event.py new file mode 100644 index 00000000..75550aff --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent(BaseModel): + """ + LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..e6e51a5c --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_customer.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_customer.py new file mode 100644 index 00000000..d4660f2d --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer(BaseModel): + """ + LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_customer_metadata.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_customer_metadata.py new file mode 100644 index 00000000..a4ef131b --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order.py new file mode 100644 index 00000000..ca102e98 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_metadata import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder(BaseModel): + """ + LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder + """ # noqa: E501 + amount: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount] = None + total_amount: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount] = None + metadata: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_amount.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_amount.py new file mode 100644 index 00000000..2abe4e42 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items.py new file mode 100644 index 00000000..6b804f1c --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems(BaseModel): + """ + LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity] = None + amount: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_amount.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_amount.py new file mode 100644 index 00000000..2a51969f --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity.py new file mode 100644 index 00000000..8f57dd64 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..00fe014e --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_metadata.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_metadata.py new file mode 100644 index 00000000..17434127 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_total_amount.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_total_amount.py new file mode 100644 index 00000000..8b98b079 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_tier.py b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_tier.py new file mode 100644 index 00000000..15373b54 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_loyalty_tier.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier(BaseModel): + """ + Defines the tier associated with the earning rule definition. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodyLoyaltyTier 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_segment.py b/voucherify/models/loyalties_earning_rules_disable_response_body_segment.py new file mode 100644 index 00000000..a1c977ca --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_segment.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodySegment(BaseModel): + """ + Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a customer segment. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodySegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodySegment 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_disable_response_body_source.py b/voucherify/models/loyalties_earning_rules_disable_response_body_source.py new file mode 100644 index 00000000..bc755363 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_disable_response_body_source.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesDisableResponseBodySource(BaseModel): + """ + Contains the custom earning rule name and parent campaign. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + object_id: Optional[StrictStr] = Field(default=None, description="A unique campaign identifier assigned by the Voucherify API.") + object_type: Optional[StrictStr] = Field(default='campaign', description="Defines the object associated with the earning rule. Defaults to `campaign`.") + __properties: ClassVar[List[str]] = ["banner", "object_id", "object_type"] + + @field_validator('object_type') + def object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodySource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if object_id (nullable) is None + # and model_fields_set contains the field + if self.object_id is None and "object_id" in self.model_fields_set: + _dict['object_id'] = None + + # set to None if object_type (nullable) is None + # and model_fields_set contains the field + if self.object_type is None and "object_type" in self.model_fields_set: + _dict['object_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesDisableResponseBodySource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner"), + "object_id": obj.get("object_id"), + "object_type": obj.get("object_type") if obj.get("object_type") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body.py b/voucherify/models/loyalties_earning_rules_enable_response_body.py new file mode 100644 index 00000000..d4c128b5 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body.py @@ -0,0 +1,242 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_enable_response_body_custom_event import LoyaltiesEarningRulesEnableResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty import LoyaltiesEarningRulesEnableResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_tier import LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_enable_response_body_segment import LoyaltiesEarningRulesEnableResponseBodySegment +from voucherify.models.loyalties_earning_rules_enable_response_body_source import LoyaltiesEarningRulesEnableResponseBodySource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable` + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the earning rule object.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.") + loyalty: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyalty] = None + event: Optional[StrictStr] = None + custom_event: Optional[LoyaltiesEarningRulesEnableResponseBodyCustomEvent] = None + segment: Optional[LoyaltiesEarningRulesEnableResponseBodySegment] = None + loyalty_tier: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier] = None + source: Optional[LoyaltiesEarningRulesEnableResponseBodySource] = None + object: Optional[StrictStr] = Field(default='earning_rule', description="The type of the object represented by JSON. Default is earning_rule.") + automation_id: Optional[StrictStr] = Field(default=None, description="For internal use by Voucherify.") + start_date: Optional[StrictStr] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.") + expiration_date: Optional[StrictStr] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.") + active: Optional[StrictBool] = Field(default=True, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.") + __properties: ClassVar[List[str]] = ["id", "created_at", "loyalty", "event", "custom_event", "segment", "loyalty_tier", "source", "object", "automation_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata", "updated_at", "active"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule']): + raise ValueError("must be one of enum values ('earning_rule')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBody 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if automation_id (nullable) is None + # and model_fields_set contains the field + if self.automation_id is None and "automation_id" in self.model_fields_set: + _dict['automation_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBody 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"), + "created_at": obj.get("created_at"), + "loyalty": LoyaltiesEarningRulesEnableResponseBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "event": obj.get("event"), + "custom_event": LoyaltiesEarningRulesEnableResponseBodyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "segment": LoyaltiesEarningRulesEnableResponseBodySegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "source": LoyaltiesEarningRulesEnableResponseBodySource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'earning_rule', + "automation_id": obj.get("automation_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata"), + "updated_at": obj.get("updated_at"), + "active": obj.get("active") if obj.get("active") is not None else True + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_custom_event.py b/voucherify/models/loyalties_earning_rules_enable_response_body_custom_event.py new file mode 100644 index 00000000..da3cb46e --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_custom_event.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyCustomEvent(BaseModel): + """ + Contains details about the custom event. + """ # noqa: E501 + schema_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the custom event schema") + __properties: ClassVar[List[str]] = ["schema_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyCustomEvent 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, + ) + # set to None if schema_id (nullable) is None + # and model_fields_set contains the field + if self.schema_id is None and "schema_id" in self.model_fields_set: + _dict['schema_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "schema_id": obj.get("schema_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty.py new file mode 100644 index 00000000..225188dd --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_custom_event import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_customer import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyalty(BaseModel): + """ + LoyaltiesEarningRulesEnableResponseBodyLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + calculation_type: Optional[StrictStr] = None + order: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder] = None + order_items: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems] = None + customer: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer] = None + custom_event: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + __properties: ClassVar[List[str]] = ["type", "calculation_type", "order", "order_items", "customer", "custom_event", "points"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PROPORTIONAL', 'FIXED']): + raise ValueError("must be one of enum values ('PROPORTIONAL', 'FIXED')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA']): + raise ValueError("must be one of enum values ('ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyalty 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if calculation_type (nullable) is None + # and model_fields_set contains the field + if self.calculation_type is None and "calculation_type" in self.model_fields_set: + _dict['calculation_type'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if order_items (nullable) is None + # and model_fields_set contains the field + if self.order_items is None and "order_items" in self.model_fields_set: + _dict['order_items'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "calculation_type": obj.get("calculation_type"), + "order": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "order_items": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "customer": LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "custom_event": LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event.py new file mode 100644 index 00000000..07ab7f8e --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent(BaseModel): + """ + LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..1be19ac0 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_customer.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_customer.py new file mode 100644 index 00000000..653abb2a --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer(BaseModel): + """ + LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_customer_metadata.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_customer_metadata.py new file mode 100644 index 00000000..a382767b --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order.py new file mode 100644 index 00000000..f09cb5b8 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_metadata import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder(BaseModel): + """ + LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder + """ # noqa: E501 + amount: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount] = None + total_amount: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount] = None + metadata: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_amount.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_amount.py new file mode 100644 index 00000000..c0377261 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items.py new file mode 100644 index 00000000..98302721 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems(BaseModel): + """ + LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity] = None + amount: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_amount.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_amount.py new file mode 100644 index 00000000..b71d9ecb --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity.py new file mode 100644 index 00000000..ceca8512 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..7a3c5391 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_metadata.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_metadata.py new file mode 100644 index 00000000..c9d334da --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_total_amount.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_total_amount.py new file mode 100644 index 00000000..21bfc795 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_tier.py b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_tier.py new file mode 100644 index 00000000..01ec7aad --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_loyalty_tier.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier(BaseModel): + """ + Defines the tier associated with the earning rule definition. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodyLoyaltyTier 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_segment.py b/voucherify/models/loyalties_earning_rules_enable_response_body_segment.py new file mode 100644 index 00000000..95dff8fb --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_segment.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodySegment(BaseModel): + """ + Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a customer segment. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodySegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodySegment 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_enable_response_body_source.py b/voucherify/models/loyalties_earning_rules_enable_response_body_source.py new file mode 100644 index 00000000..b7153004 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_enable_response_body_source.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesEnableResponseBodySource(BaseModel): + """ + Contains the custom earning rule name and parent campaign. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + object_id: Optional[StrictStr] = Field(default=None, description="A unique campaign identifier assigned by the Voucherify API.") + object_type: Optional[StrictStr] = Field(default='campaign', description="Defines the object associated with the earning rule. Defaults to `campaign`.") + __properties: ClassVar[List[str]] = ["banner", "object_id", "object_type"] + + @field_validator('object_type') + def object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodySource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if object_id (nullable) is None + # and model_fields_set contains the field + if self.object_id is None and "object_id" in self.model_fields_set: + _dict['object_id'] = None + + # set to None if object_type (nullable) is None + # and model_fields_set contains the field + if self.object_type is None and "object_type" in self.model_fields_set: + _dict['object_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesEnableResponseBodySource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner"), + "object_id": obj.get("object_id"), + "object_type": obj.get("object_type") if obj.get("object_type") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body.py b/voucherify/models/loyalties_earning_rules_get_response_body.py new file mode 100644 index 00000000..cee177b1 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_get_response_body_custom_event import LoyaltiesEarningRulesGetResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty import LoyaltiesEarningRulesGetResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_tier import LoyaltiesEarningRulesGetResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_get_response_body_segment import LoyaltiesEarningRulesGetResponseBodySegment +from voucherify.models.loyalties_earning_rules_get_response_body_source import LoyaltiesEarningRulesGetResponseBodySource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the earning rule object.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.") + loyalty: Optional[LoyaltiesEarningRulesGetResponseBodyLoyalty] = None + event: Optional[StrictStr] = None + custom_event: Optional[LoyaltiesEarningRulesGetResponseBodyCustomEvent] = None + segment: Optional[LoyaltiesEarningRulesGetResponseBodySegment] = None + loyalty_tier: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyTier] = None + source: Optional[LoyaltiesEarningRulesGetResponseBodySource] = None + object: Optional[StrictStr] = Field(default='earning_rule', description="The type of the object represented by JSON. Default is earning_rule.") + automation_id: Optional[StrictStr] = Field(default=None, description="For internal use by Voucherify.") + start_date: Optional[StrictStr] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.") + expiration_date: Optional[StrictStr] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.") + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule") + __properties: ClassVar[List[str]] = ["id", "created_at", "loyalty", "event", "custom_event", "segment", "loyalty_tier", "source", "object", "automation_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata", "validation_rule_id", "updated_at", "active"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule']): + raise ValueError("must be one of enum values ('earning_rule')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBody 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if automation_id (nullable) is None + # and model_fields_set contains the field + if self.automation_id is None and "automation_id" in self.model_fields_set: + _dict['automation_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBody 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"), + "created_at": obj.get("created_at"), + "loyalty": LoyaltiesEarningRulesGetResponseBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "event": obj.get("event"), + "custom_event": LoyaltiesEarningRulesGetResponseBodyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "segment": LoyaltiesEarningRulesGetResponseBodySegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": LoyaltiesEarningRulesGetResponseBodyLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "source": LoyaltiesEarningRulesGetResponseBodySource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'earning_rule', + "automation_id": obj.get("automation_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata"), + "validation_rule_id": obj.get("validation_rule_id"), + "updated_at": obj.get("updated_at"), + "active": obj.get("active") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_custom_event.py b/voucherify/models/loyalties_earning_rules_get_response_body_custom_event.py new file mode 100644 index 00000000..fc8aa8ec --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_custom_event.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyCustomEvent(BaseModel): + """ + Contains details about the custom event. + """ # noqa: E501 + schema_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the custom event schema") + __properties: ClassVar[List[str]] = ["schema_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyCustomEvent 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, + ) + # set to None if schema_id (nullable) is None + # and model_fields_set contains the field + if self.schema_id is None and "schema_id" in self.model_fields_set: + _dict['schema_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "schema_id": obj.get("schema_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty.py new file mode 100644 index 00000000..744a1642 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_earning_rules_get_response_body_loyalty_custom_event import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_customer import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyalty(BaseModel): + """ + LoyaltiesEarningRulesGetResponseBodyLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + calculation_type: Optional[StrictStr] = None + order: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder] = None + order_items: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems] = None + customer: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer] = None + custom_event: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + __properties: ClassVar[List[str]] = ["type", "calculation_type", "order", "order_items", "customer", "custom_event", "points"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PROPORTIONAL', 'FIXED']): + raise ValueError("must be one of enum values ('PROPORTIONAL', 'FIXED')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA']): + raise ValueError("must be one of enum values ('ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyalty 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if calculation_type (nullable) is None + # and model_fields_set contains the field + if self.calculation_type is None and "calculation_type" in self.model_fields_set: + _dict['calculation_type'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if order_items (nullable) is None + # and model_fields_set contains the field + if self.order_items is None and "order_items" in self.model_fields_set: + _dict['order_items'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "calculation_type": obj.get("calculation_type"), + "order": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "order_items": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "customer": LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "custom_event": LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_custom_event.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_custom_event.py new file mode 100644 index 00000000..ab27c881 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent(BaseModel): + """ + LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..48cf1802 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_customer.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_customer.py new file mode 100644 index 00000000..554497c5 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer(BaseModel): + """ + LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_customer_metadata.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_customer_metadata.py new file mode 100644 index 00000000..35f62283 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order.py new file mode 100644 index 00000000..1dc66f2f --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_metadata import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder(BaseModel): + """ + LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder + """ # noqa: E501 + amount: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount] = None + total_amount: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount] = None + metadata: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_amount.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_amount.py new file mode 100644 index 00000000..16935b20 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items.py new file mode 100644 index 00000000..386b7dac --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems(BaseModel): + """ + LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity] = None + amount: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_amount.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_amount.py new file mode 100644 index 00000000..e187123b --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_quantity.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_quantity.py new file mode 100644 index 00000000..3a41c702 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..1157af67 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_metadata.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_metadata.py new file mode 100644 index 00000000..1b434925 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_total_amount.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_total_amount.py new file mode 100644 index 00000000..952c41eb --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_tier.py b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_tier.py new file mode 100644 index 00000000..381d555a --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_loyalty_tier.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodyLoyaltyTier(BaseModel): + """ + Defines the tier associated with the earning rule definition. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodyLoyaltyTier 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_segment.py b/voucherify/models/loyalties_earning_rules_get_response_body_segment.py new file mode 100644 index 00000000..868624a1 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_segment.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodySegment(BaseModel): + """ + Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a customer segment. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodySegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodySegment 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_get_response_body_source.py b/voucherify/models/loyalties_earning_rules_get_response_body_source.py new file mode 100644 index 00000000..392b7406 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_get_response_body_source.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesGetResponseBodySource(BaseModel): + """ + Contains the custom earning rule name and parent campaign. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + object_id: Optional[StrictStr] = Field(default=None, description="A unique campaign identifier assigned by the Voucherify API.") + object_type: Optional[StrictStr] = Field(default='campaign', description="Defines the object associated with the earning rule. Defaults to `campaign`.") + __properties: ClassVar[List[str]] = ["banner", "object_id", "object_type"] + + @field_validator('object_type') + def object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodySource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if object_id (nullable) is None + # and model_fields_set contains the field + if self.object_id is None and "object_id" in self.model_fields_set: + _dict['object_id'] = None + + # set to None if object_type (nullable) is None + # and model_fields_set contains the field + if self.object_type is None and "object_type" in self.model_fields_set: + _dict['object_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesGetResponseBodySource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner"), + "object_id": obj.get("object_id"), + "object_type": obj.get("object_type") if obj.get("object_type") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_list_response_body.py b/voucherify/models/loyalties_earning_rules_list_response_body.py new file mode 100644 index 00000000..6d71db93 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_list_response_body.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.earning_rule import EarningRule +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesListResponseBody(BaseModel): + """ + Response body schema for listing earning rules using **GET** `v1/loyalties/{campaignId}/earning-rules` endpoint. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about earning rules in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of earning rule objects.") + data: Optional[List[EarningRule]] = Field(default=None, description="Contains array of earning rule objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of earning rule objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [EarningRule.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body.py b/voucherify/models/loyalties_earning_rules_update_request_body.py new file mode 100644 index 00000000..746d8ab6 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body.py @@ -0,0 +1,169 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty import LoyaltiesEarningRulesUpdateRequestBodyLoyalty +from voucherify.models.loyalties_earning_rules_update_request_body_source import LoyaltiesEarningRulesUpdateRequestBodySource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBody(BaseModel): + """ + LoyaltiesEarningRulesUpdateRequestBody + """ # noqa: E501 + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + loyalty: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyalty] = None + source: Optional[LoyaltiesEarningRulesUpdateRequestBodySource] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. - `true` indicates an *active* earning rule - `false` indicates an *inactive* earning rule") + start_date: Optional[datetime] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.") + __properties: ClassVar[List[str]] = ["validation_rule_id", "loyalty", "source", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBody 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "validation_rule_id": obj.get("validation_rule_id"), + "loyalty": LoyaltiesEarningRulesUpdateRequestBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "source": LoyaltiesEarningRulesUpdateRequestBodySource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty.py new file mode 100644 index 00000000..c5ab74a9 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_earning_rules_update_request_body_loyalty_custom_event import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_customer import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyalty(BaseModel): + """ + LoyaltiesEarningRulesUpdateRequestBodyLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + calculation_type: Optional[StrictStr] = None + order: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder] = None + order_items: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems] = None + customer: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer] = None + custom_event: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + __properties: ClassVar[List[str]] = ["type", "calculation_type", "order", "order_items", "customer", "custom_event", "points"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PROPORTIONAL', 'FIXED']): + raise ValueError("must be one of enum values ('PROPORTIONAL', 'FIXED')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA']): + raise ValueError("must be one of enum values ('ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyalty 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if calculation_type (nullable) is None + # and model_fields_set contains the field + if self.calculation_type is None and "calculation_type" in self.model_fields_set: + _dict['calculation_type'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if order_items (nullable) is None + # and model_fields_set contains the field + if self.order_items is None and "order_items" in self.model_fields_set: + _dict['order_items'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "calculation_type": obj.get("calculation_type"), + "order": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "order_items": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "customer": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "custom_event": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_custom_event.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_custom_event.py new file mode 100644 index 00000000..acf8638c --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent(BaseModel): + """ + LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..a841e721 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_customer.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_customer.py new file mode 100644 index 00000000..23380956 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_customer_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer(BaseModel): + """ + LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_customer_metadata.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_customer_metadata.py new file mode 100644 index 00000000..8945406c --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order.py new file mode 100644 index 00000000..e0107695 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_metadata import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_total_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder(BaseModel): + """ + LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder + """ # noqa: E501 + amount: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount] = None + total_amount: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount] = None + metadata: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_amount.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_amount.py new file mode 100644 index 00000000..b8ebad59 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items.py new file mode 100644 index 00000000..e5a4177d --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_quantity import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems(BaseModel): + """ + LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity] = None + amount: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_amount.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_amount.py new file mode 100644 index 00000000..fc4fda75 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_quantity.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_quantity.py new file mode 100644 index 00000000..85e3b1c0 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..2dd4b274 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_metadata.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_metadata.py new file mode 100644 index 00000000..680de97b --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_total_amount.py b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_total_amount.py new file mode 100644 index 00000000..39aea218 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodyLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_request_body_source.py b/voucherify/models/loyalties_earning_rules_update_request_body_source.py new file mode 100644 index 00000000..d15a591b --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_request_body_source.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateRequestBodySource(BaseModel): + """ + Contains the custom earning rule name and parent campaign. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + __properties: ClassVar[List[str]] = ["banner"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodySource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateRequestBodySource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body.py b/voucherify/models/loyalties_earning_rules_update_response_body.py new file mode 100644 index 00000000..e4a2aba3 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_response_body_custom_event import LoyaltiesEarningRulesUpdateResponseBodyCustomEvent +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty import LoyaltiesEarningRulesUpdateResponseBodyLoyalty +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_tier import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier +from voucherify.models.loyalties_earning_rules_update_response_body_segment import LoyaltiesEarningRulesUpdateResponseBodySegment +from voucherify.models.loyalties_earning_rules_update_response_body_source import LoyaltiesEarningRulesUpdateResponseBodySource +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the earning rule object.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.") + loyalty: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyalty] = None + event: Optional[StrictStr] = None + custom_event: Optional[LoyaltiesEarningRulesUpdateResponseBodyCustomEvent] = None + segment: Optional[LoyaltiesEarningRulesUpdateResponseBodySegment] = None + loyalty_tier: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier] = None + source: Optional[LoyaltiesEarningRulesUpdateResponseBodySource] = None + object: Optional[StrictStr] = Field(default='earning_rule', description="The type of the object represented by JSON. Default is earning_rule.") + automation_id: Optional[StrictStr] = Field(default=None, description="For internal use by Voucherify.") + start_date: Optional[StrictStr] = Field(default=None, description="Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.") + expiration_date: Optional[StrictStr] = Field(default=None, description="Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.") + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date. - `true` indicates an active earning rule - `false` indicates an inactive earning rule") + __properties: ClassVar[List[str]] = ["id", "created_at", "loyalty", "event", "custom_event", "segment", "loyalty_tier", "source", "object", "automation_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "metadata", "validation_rule_id", "updated_at", "active"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule']): + raise ValueError("must be one of enum values ('earning_rule')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBody 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if automation_id (nullable) is None + # and model_fields_set contains the field + if self.automation_id is None and "automation_id" in self.model_fields_set: + _dict['automation_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBody 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"), + "created_at": obj.get("created_at"), + "loyalty": LoyaltiesEarningRulesUpdateResponseBodyLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None, + "event": obj.get("event"), + "custom_event": LoyaltiesEarningRulesUpdateResponseBodyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "segment": LoyaltiesEarningRulesUpdateResponseBodySegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "source": LoyaltiesEarningRulesUpdateResponseBodySource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'earning_rule', + "automation_id": obj.get("automation_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "metadata": obj.get("metadata"), + "validation_rule_id": obj.get("validation_rule_id"), + "updated_at": obj.get("updated_at"), + "active": obj.get("active") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_custom_event.py b/voucherify/models/loyalties_earning_rules_update_response_body_custom_event.py new file mode 100644 index 00000000..07f75a17 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_custom_event.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyCustomEvent(BaseModel): + """ + Contains details about the custom event. + """ # noqa: E501 + schema_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the custom event schema") + __properties: ClassVar[List[str]] = ["schema_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyCustomEvent 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, + ) + # set to None if schema_id (nullable) is None + # and model_fields_set contains the field + if self.schema_id is None and "schema_id" in self.model_fields_set: + _dict['schema_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "schema_id": obj.get("schema_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty.py new file mode 100644 index 00000000..851f2ef4 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_earning_rules_update_response_body_loyalty_custom_event import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_customer import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyalty(BaseModel): + """ + LoyaltiesEarningRulesUpdateResponseBodyLoyalty + """ # noqa: E501 + type: Optional[StrictStr] = None + calculation_type: Optional[StrictStr] = None + order: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder] = None + order_items: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems] = None + customer: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer] = None + custom_event: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent] = None + points: Optional[StrictInt] = Field(default=None, description="Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.") + __properties: ClassVar[List[str]] = ["type", "calculation_type", "order", "order_items", "customer", "custom_event", "points"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PROPORTIONAL', 'FIXED']): + raise ValueError("must be one of enum values ('PROPORTIONAL', 'FIXED')") + return value + + @field_validator('calculation_type') + def calculation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA']): + raise ValueError("must be one of enum values ('ORDER_AMOUNT', 'ORDER_TOTAL_AMOUNT', 'ORDER_METADATA', 'ORDER_ITEMS_QUANTITY', 'ORDER_ITEMS_AMOUNT', 'ORDER_ITEMS_SUBTOTAL_AMOUNT', 'CUSTOMER_METADATA', 'CUSTOM_EVENT_METADATA')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyalty 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_items + if self.order_items: + _dict['order_items'] = self.order_items.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if calculation_type (nullable) is None + # and model_fields_set contains the field + if self.calculation_type is None and "calculation_type" in self.model_fields_set: + _dict['calculation_type'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if order_items (nullable) is None + # and model_fields_set contains the field + if self.order_items is None and "order_items" in self.model_fields_set: + _dict['order_items'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "calculation_type": obj.get("calculation_type"), + "order": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "order_items": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems.from_dict(obj["order_items"]) if obj.get("order_items") is not None else None, + "customer": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "custom_event": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_custom_event.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_custom_event.py new file mode 100644 index 00000000..8d89b382 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_custom_event.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent(BaseModel): + """ + LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata.py new file mode 100644 index 00000000..ca4e57c6 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_custom_event_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description=" Custom event metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomEventMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_customer.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_customer.py new file mode 100644 index 00000000..bbf871ba --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_customer.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_customer_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer(BaseModel): + """ + LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer + """ # noqa: E501 + metadata: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata] = None + __properties: ClassVar[List[str]] = ["metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_customer_metadata.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_customer_metadata.py new file mode 100644 index 00000000..19d6cb9c --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_customer_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the customer metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Customer metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyCustomerMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order.py new file mode 100644 index 00000000..1bada50b --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_metadata import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_total_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder(BaseModel): + """ + LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder + """ # noqa: E501 + amount: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount] = None + total_amount: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount] = None + metadata: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata] = None + __properties: ClassVar[List[str]] = ["amount", "total_amount", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder 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 amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_amount + if self.total_amount: + _dict['total_amount'] = self.total_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "total_amount": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount.from_dict(obj["total_amount"]) if obj.get("total_amount") is not None else None, + "metadata": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_amount.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_amount.py new file mode 100644 index 00000000..536053df --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items.py new file mode 100644 index 00000000..2b2533e4 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_quantity import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity +from voucherify.models.loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount import LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems(BaseModel): + """ + LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems + """ # noqa: E501 + quantity: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity] = None + amount: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount] = None + subtotal_amount: Optional[LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount] = None + __properties: ClassVar[List[str]] = ["quantity", "amount", "subtotal_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems 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 quantity + if self.quantity: + _dict['quantity'] = self.quantity.to_dict() + # override the default output from pydantic by calling `to_dict()` of amount + if self.amount: + _dict['amount'] = self.amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of subtotal_amount + if self.subtotal_amount: + _dict['subtotal_amount'] = self.subtotal_amount.to_dict() + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity.from_dict(obj["quantity"]) if obj.get("quantity") is not None else None, + "amount": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None, + "subtotal_amount": LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount.from_dict(obj["subtotal_amount"]) if obj.get("subtotal_amount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_amount.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_amount.py new file mode 100644 index 00000000..dc3eaf7c --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_quantity.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_quantity.py new file mode 100644 index 00000000..4ef7190f --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_quantity.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsQuantity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount.py new file mode 100644 index 00000000..43e9ee91 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_items_subtotal_amount.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + object: Optional[StrictStr] = Field(default=None, description="Type of object taken under consideration.") + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619.") + __properties: ClassVar[List[str]] = ["every", "points", "object", "id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection', 'product', 'sku']): + raise ValueError("must be one of enum values ('products_collection', 'product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderItemsSubtotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "object": obj.get("object"), + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_metadata.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_metadata.py new file mode 100644 index 00000000..6eec8a99 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="For how many increments of the order metadata property to grant points for.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + var_property: Optional[StrictStr] = Field(default=None, description="Order metadata property.", alias="property") + __properties: ClassVar[List[str]] = ["every", "points", "property"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if var_property (nullable) is None + # and model_fields_set contains the field + if self.var_property is None and "var_property" in self.model_fields_set: + _dict['property'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points"), + "property": obj.get("property") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_total_amount.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_total_amount.py new file mode 100644 index 00000000..f3cfb165 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_order_total_amount.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount(BaseModel): + """ + Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. + """ # noqa: E501 + every: Optional[StrictInt] = Field(default=None, description="Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000.") + points: Optional[StrictInt] = Field(default=None, description="Number of points to be awarded, i.e. how many points to be added to the loyalty card.") + __properties: ClassVar[List[str]] = ["every", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount 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, + ) + # set to None if every (nullable) is None + # and model_fields_set contains the field + if self.every is None and "every" in self.model_fields_set: + _dict['every'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyOrderTotalAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "every": obj.get("every"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_tier.py b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_tier.py new file mode 100644 index 00000000..9db7a4f7 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_loyalty_tier.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier(BaseModel): + """ + Defines the tier associated with the earning rule definition. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID associated with the earning rule. - `__ANY__`: any loyalty tier within the campaign") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodyLoyaltyTier 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_segment.py b/voucherify/models/loyalties_earning_rules_update_response_body_segment.py new file mode 100644 index 00000000..2f04ebf1 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_segment.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodySegment(BaseModel): + """ + Contains the ID of a customer segment. Required for the `customer.segment.entered` option in the event. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Contains a unique identifier of a customer segment. Assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodySegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodySegment 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") + }) + return _obj + + diff --git a/voucherify/models/loyalties_earning_rules_update_response_body_source.py b/voucherify/models/loyalties_earning_rules_update_response_body_source.py new file mode 100644 index 00000000..d3f5a8a8 --- /dev/null +++ b/voucherify/models/loyalties_earning_rules_update_response_body_source.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltiesEarningRulesUpdateResponseBodySource(BaseModel): + """ + Contains the custom earning rule name and parent campaign. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + object_id: Optional[StrictStr] = Field(default=None, description="A unique campaign identifier assigned by the Voucherify API.") + object_type: Optional[StrictStr] = Field(default='campaign', description="Defines the object associated with the earning rule. Defaults to `campaign`.") + __properties: ClassVar[List[str]] = ["banner", "object_id", "object_type"] + + @field_validator('object_type') + def object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodySource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if object_id (nullable) is None + # and model_fields_set contains the field + if self.object_id is None and "object_id" in self.model_fields_set: + _dict['object_id'] = None + + # set to None if object_type (nullable) is None + # and model_fields_set contains the field + if self.object_type is None and "object_type" in self.model_fields_set: + _dict['object_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesEarningRulesUpdateResponseBodySource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner"), + "object_id": obj.get("object_id"), + "object_type": obj.get("object_type") if obj.get("object_type") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/loyalties_get_campaign_response_body.py b/voucherify/models/loyalties_get_campaign_response_body.py new file mode 100644 index 00000000..7ce9849a --- /dev/null +++ b/voucherify/models/loyalties_get_campaign_response_body.py @@ -0,0 +1,345 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.category import Category +from voucherify.models.loyalty_campaign_voucher import LoyaltyCampaignVoucher +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesGetCampaignResponseBody(BaseModel): + """ + Response body schema for **GET** `/loyalties/{campaignId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default='LOYALTY_PROGRAM', description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[LoyaltyCampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + access_settings_assignments: Optional[AccessSettingsCampaignAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "loyalty_tiers_expiration", "validation_rules_assignments", "access_settings_assignments"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesGetCampaignResponseBody 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of access_settings_assignments + if self.access_settings_assignments: + _dict['access_settings_assignments'] = self.access_settings_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesGetCampaignResponseBody 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type") if obj.get("campaign_type") is not None else 'LOYALTY_PROGRAM', + "type": obj.get("type"), + "voucher": LoyaltyCampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "access_settings_assignments": AccessSettingsCampaignAssignmentsList.from_dict(obj["access_settings_assignments"]) if obj.get("access_settings_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_list_campaigns_response_body.py b/voucherify/models/loyalties_list_campaigns_response_body.py new file mode 100644 index 00000000..7349667a --- /dev/null +++ b/voucherify/models/loyalties_list_campaigns_response_body.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalty_campaign import LoyaltyCampaign +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesListCampaignsResponseBody(BaseModel): + """ + Response body schema for **Get** `/loyalties`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about loyalty campaigns in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='campaigns', description="Identifies the name of the attribute that contains the array of loyalty campaign objects.") + campaigns: Optional[List[LoyaltyCampaign]] = Field(default=None, description="Contains an array of loyalty campaign objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of loyalty campaign objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "campaigns", "total"] + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaigns']): + raise ValueError("must be one of enum values ('campaigns')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesListCampaignsResponseBody 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 campaigns (list) + _items = [] + if self.campaigns: + for _item_campaigns in self.campaigns: + if _item_campaigns: + _items.append(_item_campaigns.to_dict()) + _dict['campaigns'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if campaigns (nullable) is None + # and model_fields_set contains the field + if self.campaigns is None and "campaigns" in self.model_fields_set: + _dict['campaigns'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesListCampaignsResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'campaigns', + "campaigns": [LoyaltyCampaign.from_dict(_item) for _item in obj["campaigns"]] if obj.get("campaigns") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_list_members_response_body.py b/voucherify/models/loyalties_list_members_response_body.py new file mode 100644 index 00000000..ae71fb3b --- /dev/null +++ b/voucherify/models/loyalties_list_members_response_body.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalty_member import LoyaltyMember +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesListMembersResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/members`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about members in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='vouchers', description="Identifies the name of the attribute that contains the array of voucher objects.") + vouchers: Optional[List[LoyaltyMember]] = Field(default=None, description="Contains array of voucher objects representing loyalty cards, in other words, loyalty program members.") + total: Optional[StrictInt] = Field(default=None, description="Total number of voucher objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "vouchers", "total"] + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['vouchers']): + raise ValueError("must be one of enum values ('vouchers')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesListMembersResponseBody 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 vouchers (list) + _items = [] + if self.vouchers: + for _item_vouchers in self.vouchers: + if _item_vouchers: + _items.append(_item_vouchers.to_dict()) + _dict['vouchers'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if vouchers (nullable) is None + # and model_fields_set contains the field + if self.vouchers is None and "vouchers" in self.model_fields_set: + _dict['vouchers'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesListMembersResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'vouchers', + "vouchers": [LoyaltyMember.from_dict(_item) for _item in obj["vouchers"]] if obj.get("vouchers") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_loyalty_tier_reward.py b/voucherify/models/loyalties_loyalty_tier_reward.py new file mode 100644 index 00000000..a247e77a --- /dev/null +++ b/voucherify/models/loyalties_loyalty_tier_reward.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.reward import Reward +from voucherify.models.reward_assignment import RewardAssignment +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesLoyaltyTierReward(BaseModel): + """ + This is an object representing a loyalty tier reward. + """ # noqa: E501 + reward: Reward + assignment: RewardAssignment + object: StrictStr = Field(description="The type of the object represented by JSON. This object stores information about the loyalty tier reward.") + __properties: ClassVar[List[str]] = ["reward", "assignment", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['loyalty_tier_reward']): + raise ValueError("must be one of enum values ('loyalty_tier_reward')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesLoyaltyTierReward 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 reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of assignment + if self.assignment: + _dict['assignment'] = self.assignment.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesLoyaltyTierReward from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reward": Reward.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "assignment": RewardAssignment.from_dict(obj["assignment"]) if obj.get("assignment") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'loyalty_tier_reward' + }) + return _obj + + diff --git a/voucherify/models/loyalties_member_activity_list_response_body.py b/voucherify/models/loyalties_member_activity_list_response_body.py new file mode 100644 index 00000000..1eef2ed6 --- /dev/null +++ b/voucherify/models/loyalties_member_activity_list_response_body.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.member_activity import MemberActivity +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMemberActivityListResponseBody(BaseModel): + """ + Response body schema for retrieving member activity. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about member activities in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of member activity objects.") + data: Optional[List[MemberActivity]] = Field(default=None, description="Array of member activity objects.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request with a `starting_after_id` query or a different limit to get more records returned in the results.") + more_starting_after: Optional[StrictStr] = Field(default=None, description="Returns an ID that can be used to return another page of results. Use the event ID in the `starting_after_id` query parameter to display another page of the results starting after the event with that ID.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "has_more", "more_starting_after"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMemberActivityListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + # set to None if more_starting_after (nullable) is None + # and model_fields_set contains the field + if self.more_starting_after is None and "more_starting_after" in self.model_fields_set: + _dict['more_starting_after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMemberActivityListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [MemberActivity.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "more_starting_after": obj.get("more_starting_after") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_balance_update_request_body.py b/voucherify/models/loyalties_members_balance_update_request_body.py new file mode 100644 index 00000000..1d7cd0da --- /dev/null +++ b/voucherify/models/loyalties_members_balance_update_request_body.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.points_expiration_types import PointsExpirationTypes +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersBalanceUpdateRequestBody(BaseModel): + """ + Request Body schema for **POST** `v1/loyalties/members/{memberId}/balance` and **POST** `v1/loyalties/{campaignId}/members/{memberId}/balance`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Incremental balance to be added to/subtracted from the loyalty card. - To add points: 100 - To subtract points, add a minus: -100") + expiration_type: Optional[PointsExpirationTypes] = None + expiration_date: Optional[datetime] = Field(default=None, description="Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`.") + reason: Optional[StrictStr] = Field(default=None, description="Reason for the transfer.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service.") + __properties: ClassVar[List[str]] = ["points", "expiration_type", "expiration_date", "reason", "source_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersBalanceUpdateRequestBody 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersBalanceUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "expiration_type": obj.get("expiration_type"), + "expiration_date": obj.get("expiration_date"), + "reason": obj.get("reason"), + "source_id": obj.get("source_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_balance_update_response_body.py b/voucherify/models/loyalties_members_balance_update_response_body.py new file mode 100644 index 00000000..e89eaf2c --- /dev/null +++ b/voucherify/models/loyalties_members_balance_update_response_body.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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_extensions import Annotated +from voucherify.models.loyalties_members_balance_update_response_body_related_object import LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersBalanceUpdateResponseBody(BaseModel): + """ + Response schema for **POST** `v1/loyalties/members/{memberId}/balance` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/balance`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The incremental points removed or added to the current balance on the loyalty card.") + total: Optional[StrictInt] = Field(default=None, description="The total of points accrued over the lifetime of the loyalty card.") + balance: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The balance after adding/removing points.") + type: Optional[StrictStr] = Field(default=None, description="The type of voucher being modified.") + object: Optional[Annotated[str, Field(strict=True)]] = Field(default='balance', description="The type of the object represented by JSON. Default is balance.") + related_object: Optional[LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject] = None + operation_type: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["points", "total", "balance", "type", "object", "related_object", "operation_type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['loyalty_card', 'gift_voucher']): + raise ValueError("must be one of enum values ('loyalty_card', 'gift_voucher')") + return value + + @field_validator('object') + def object_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"balance", value): + raise ValueError(r"must validate the regular expression /balance/") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['balance']): + raise ValueError("must be one of enum values ('balance')") + return value + + @field_validator('operation_type') + def operation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL', 'AUTOMATIC']): + raise ValueError("must be one of enum values ('MANUAL', 'AUTOMATIC')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersBalanceUpdateResponseBody 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 related_object + if self.related_object: + _dict['related_object'] = self.related_object.to_dict() + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object (nullable) is None + # and model_fields_set contains the field + if self.related_object is None and "related_object" in self.model_fields_set: + _dict['related_object'] = None + + # set to None if operation_type (nullable) is None + # and model_fields_set contains the field + if self.operation_type is None and "operation_type" in self.model_fields_set: + _dict['operation_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersBalanceUpdateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "total": obj.get("total"), + "balance": obj.get("balance"), + "type": obj.get("type"), + "object": obj.get("object") if obj.get("object") is not None else 'balance', + "related_object": LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject.from_dict(obj["related_object"]) if obj.get("related_object") is not None else None, + "operation_type": obj.get("operation_type") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_balance_update_response_body_related_object.py b/voucherify/models/loyalties_members_balance_update_response_body_related_object.py new file mode 100644 index 00000000..b2e72414 --- /dev/null +++ b/voucherify/models/loyalties_members_balance_update_response_body_related_object.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject(BaseModel): + """ + Defines the object that is being modified with the values that are returned in the balance object. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default='voucher', description="The object being modified.") + id: Optional[StrictStr] = Field(default=None, description="Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["type", "id"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject 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, + ) + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersBalanceUpdateResponseBodyRelatedObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") if obj.get("type") is not None else 'voucher', + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_create_request_body.py b/voucherify/models/loyalties_members_create_request_body.py new file mode 100644 index 00000000..233c0b9d --- /dev/null +++ b/voucherify/models/loyalties_members_create_request_body.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer import Customer +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersCreateRequestBody(BaseModel): + """ + Request body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`. + """ # noqa: E501 + voucher: Optional[StrictStr] = Field(default=None, description="Code of voucher being published.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request.") + customer: Optional[Customer] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.") + channel: Optional[StrictStr] = Field(default=None, description="Specify the distribution channel.") + __properties: ClassVar[List[str]] = ["voucher", "source_id", "customer", "metadata", "channel"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # set to None if voucher (nullable) is None + # and model_fields_set contains the field + if self.voucher is None and "voucher" in self.model_fields_set: + _dict['voucher'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "voucher": obj.get("voucher"), + "source_id": obj.get("source_id"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "metadata": obj.get("metadata"), + "channel": obj.get("channel") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_create_response_body.py b/voucherify/models/loyalties_members_create_response_body.py new file mode 100644 index 00000000..a6848435 --- /dev/null +++ b/voucherify/models/loyalties_members_create_response_body.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_members_create_response_body_loyalty_card import LoyaltiesMembersCreateResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_create_response_body_publish import LoyaltiesMembersCreateResponseBodyPublish +from voucherify.models.loyalties_members_create_response_body_redemption import LoyaltiesMembersCreateResponseBodyRedemption +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersCreateResponseBody(BaseModel): + """ + Respone body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default='LOYALTY_CARD', description="Defines the type of the voucher. ") + discount: Optional[Dict[str, Any]] = None + gift: Optional[Dict[str, Any]] = None + loyalty_card: Optional[LoyaltiesMembersCreateResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="This is always false for loyalty members.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the customer who owns the voucher.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[LoyaltiesMembersCreateResponseBodyPublish] = None + redemption: Optional[LoyaltiesMembersCreateResponseBodyRedemption] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "object", "publish", "redemption"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD']): + raise ValueError("must be one of enum values ('LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBody 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 loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if discount (nullable) is None + # and model_fields_set contains the field + if self.discount is None and "discount" in self.model_fields_set: + _dict['discount'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type") if obj.get("type") is not None else 'LOYALTY_CARD', + "discount": obj.get("discount"), + "gift": obj.get("gift"), + "loyalty_card": LoyaltiesMembersCreateResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": LoyaltiesMembersCreateResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": LoyaltiesMembersCreateResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_create_response_body_loyalty_card.py b/voucherify/models/loyalties_members_create_response_body_loyalty_card.py new file mode 100644 index 00000000..230eaa83 --- /dev/null +++ b/voucherify/models/loyalties_members_create_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersCreateResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_create_response_body_publish.py b/voucherify/models/loyalties_members_create_response_body_publish.py new file mode 100644 index 00000000..db879475 --- /dev/null +++ b/voucherify/models/loyalties_members_create_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersCreateResponseBodyPublish(BaseModel): + """ + This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication event counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_create_response_body_redemption.py b/voucherify/models/loyalties_members_create_response_body_redemption.py new file mode 100644 index 00000000..2397ea6d --- /dev/null +++ b/voucherify/models/loyalties_members_create_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersCreateResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersCreateResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_get_response_body.py b/voucherify/models/loyalties_members_get_response_body.py new file mode 100644 index 00000000..78966a6b --- /dev/null +++ b/voucherify/models/loyalties_members_get_response_body.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_members_get_response_body_loyalty_card import LoyaltiesMembersGetResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_get_response_body_publish import LoyaltiesMembersGetResponseBodyPublish +from voucherify.models.loyalties_members_get_response_body_redemption import LoyaltiesMembersGetResponseBodyRedemption +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersGetResponseBody(BaseModel): + """ + Response body schema for **GET** `/loyalties/{campaignId}/members/{memberId}` and **GET** `/loyalties/members/{memberId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default='LOYALTY_CARD', description="Defines the type of the voucher. ") + discount: Optional[Dict[str, Any]] = None + gift: Optional[Dict[str, Any]] = None + loyalty_card: Optional[LoyaltiesMembersGetResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="This is always false for loyalty members.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the customer who owns the voucher.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[LoyaltiesMembersGetResponseBodyPublish] = None + redemption: Optional[LoyaltiesMembersGetResponseBodyRedemption] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "object", "publish", "redemption"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD']): + raise ValueError("must be one of enum values ('LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBody 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 loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if discount (nullable) is None + # and model_fields_set contains the field + if self.discount is None and "discount" in self.model_fields_set: + _dict['discount'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type") if obj.get("type") is not None else 'LOYALTY_CARD', + "discount": obj.get("discount"), + "gift": obj.get("gift"), + "loyalty_card": LoyaltiesMembersGetResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": LoyaltiesMembersGetResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": LoyaltiesMembersGetResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_get_response_body_loyalty_card.py b/voucherify/models/loyalties_members_get_response_body_loyalty_card.py new file mode 100644 index 00000000..cc600442 --- /dev/null +++ b/voucherify/models/loyalties_members_get_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersGetResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_get_response_body_publish.py b/voucherify/models/loyalties_members_get_response_body_publish.py new file mode 100644 index 00000000..576df09d --- /dev/null +++ b/voucherify/models/loyalties_members_get_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersGetResponseBodyPublish(BaseModel): + """ + This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication event counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_get_response_body_redemption.py b/voucherify/models/loyalties_members_get_response_body_redemption.py new file mode 100644 index 00000000..8f573fe0 --- /dev/null +++ b/voucherify/models/loyalties_members_get_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersGetResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersGetResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_points_expiration_list_response_body.py b/voucherify/models/loyalties_members_points_expiration_list_response_body.py new file mode 100644 index 00000000..c8497a1d --- /dev/null +++ b/voucherify/models/loyalties_members_points_expiration_list_response_body.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.loyalties_members_points_expiration_list_response_body_data_item import LoyaltiesMembersPointsExpirationListResponseBodyDataItem +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersPointsExpirationListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/members/{memberId}/points-expiration`. + """ # noqa: E501 + object: Optional[Annotated[str, Field(strict=True)]] = Field(default='list', description="The type of the object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary.") + data_ref: Optional[Annotated[str, Field(strict=True)]] = Field(default='data', description="Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects.") + data: Optional[List[LoyaltiesMembersPointsExpirationListResponseBodyDataItem]] = Field(default=None, description="Contains array of loyalty points expiration buckets.") + total: Optional[StrictInt] = Field(default=None, description="Total number of point expiration buckets.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"list", value): + raise ValueError(r"must validate the regular expression /list/") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"data", value): + raise ValueError(r"must validate the regular expression /data/") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersPointsExpirationListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersPointsExpirationListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [LoyaltiesMembersPointsExpirationListResponseBodyDataItem.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_points_expiration_list_response_body_data_item.py b/voucherify/models/loyalties_members_points_expiration_list_response_body_data_item.py new file mode 100644 index 00000000..03fd0465 --- /dev/null +++ b/voucherify/models/loyalties_members_points_expiration_list_response_body_data_item.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.loyalties_members_points_expiration_list_response_body_data_item_bucket import LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersPointsExpirationListResponseBodyDataItem(BaseModel): + """ + LoyaltiesMembersPointsExpirationListResponseBodyDataItem + """ # noqa: E501 + id: StrictStr = Field(description="Unique loyalty points bucket ID.") + voucher_id: StrictStr = Field(description="Unique parent loyalty card ID.") + campaign_id: StrictStr = Field(description=" Unique parent campaign ID.") + bucket: LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket + created_at: datetime = Field(description="Timestamp representing the date and time when the loyalty points bucket object was created. The value is shown in the ISO 8601 format.") + status: StrictStr = Field(description="Loyalty points bucket point status.") + expires_at: datetime = Field(description="Date when the number of points defined in the bucket object are due to expire.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the loyalty points bucket object was updated. The value is shown in the ISO 8601 format.") + object: Annotated[str, Field(strict=True)] = Field(description="The type of the object represented by JSON. This object stores information about the loyalty points bucket.") + __properties: ClassVar[List[str]] = ["id", "voucher_id", "campaign_id", "bucket", "created_at", "status", "expires_at", "updated_at", "object"] + + @field_validator('object') + def object_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"loyalty_points_bucket", value): + raise ValueError(r"must validate the regular expression /loyalty_points_bucket/") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['loyalty_points_bucket']): + raise ValueError("must be one of enum values ('loyalty_points_bucket')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersPointsExpirationListResponseBodyDataItem 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 bucket + if self.bucket: + _dict['bucket'] = self.bucket.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersPointsExpirationListResponseBodyDataItem 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"), + "voucher_id": obj.get("voucher_id"), + "campaign_id": obj.get("campaign_id"), + "bucket": LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket.from_dict(obj["bucket"]) if obj.get("bucket") is not None else None, + "created_at": obj.get("created_at"), + "status": obj.get("status"), + "expires_at": obj.get("expires_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'loyalty_points_bucket' + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.py b/voucherify/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.py new file mode 100644 index 00000000..1c3aa239 --- /dev/null +++ b/voucherify/models/loyalties_members_points_expiration_list_response_body_data_item_bucket.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket(BaseModel): + """ + Defines the number of points stored in the given loyalty points bucket. + """ # noqa: E501 + total_points: StrictInt = Field(description="Total number of points in the loyalty points bucket.") + __properties: ClassVar[List[str]] = ["total_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket 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 LoyaltiesMembersPointsExpirationListResponseBodyDataItemBucket from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_points": obj.get("total_points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_request_body.py b/voucherify/models/loyalties_members_redemption_redeem_request_body.py new file mode 100644 index 00000000..2b8cfad7 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_request_body.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_members_redemption_redeem_request_body_reward import LoyaltiesMembersRedemptionRedeemRequestBodyReward +from voucherify.models.order import Order +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** `v1/loyalties/members/{memberId}/redemption`. + """ # noqa: E501 + reward: Optional[LoyaltiesMembersRedemptionRedeemRequestBodyReward] = None + order: Optional[Order] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can send in the request body to check against vouchers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Advanced_ → _Redemption metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).") + __properties: ClassVar[List[str]] = ["reward", "order", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemRequestBody 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 reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reward": LoyaltiesMembersRedemptionRedeemRequestBodyReward.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_request_body_reward.py b/voucherify/models/loyalties_members_redemption_redeem_request_body_reward.py new file mode 100644 index 00000000..1d1a3c07 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_request_body_reward.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemRequestBodyReward(BaseModel): + """ + Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward if the reward is a pay with points reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.") + points: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card.") + __properties: ClassVar[List[str]] = ["id", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemRequestBodyReward 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemRequestBodyReward 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"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body.py b/voucherify/models/loyalties_members_redemption_redeem_response_body.py new file mode 100644 index 00000000..4f2cebac --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body.py @@ -0,0 +1,304 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_members_redemption_redeem_response_body_channel import LoyaltiesMembersRedemptionRedeemResponseBodyChannel +from voucherify.models.loyalties_members_redemption_redeem_response_body_gift import LoyaltiesMembersRedemptionRedeemResponseBodyGift +from voucherify.models.loyalties_members_redemption_redeem_response_body_loyalty_card import LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher import LoyaltiesMembersRedemptionRedeemResponseBodyVoucher +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.promotion_tier import PromotionTier +from voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.simple_customer import SimpleCustomer +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/redemption` and for **POST** `v1/loyalties/members/{memberId}/redemption`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + object: Optional[StrictStr] = Field(default='redemption', description="The type of the object represented by the JSON") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the redeeming customer.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the redemption.") + amount: Optional[StrictInt] = Field(default=None, description="For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction.") + redemption: Optional[StrictStr] = Field(default=None, description="Unique redemption ID of the parent redemption.") + result: Optional[StrictStr] = Field(default=None, description="Redemption result.") + status: Optional[StrictStr] = Field(default=None, description="Redemption status.") + related_redemptions: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions] = None + failure_code: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed.") + order: Optional[OrderCalculated] = None + channel: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyChannel] = None + customer: Optional[SimpleCustomer] = None + related_object_type: Optional[StrictStr] = Field(default=None, description="Defines the related object.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher.") + voucher: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyVoucher] = None + promotion_tier: Optional[PromotionTier] = None + reward: Optional[RedemptionRewardResult] = None + gift: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyGift] = None + loyalty_card: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard] = None + __properties: ClassVar[List[str]] = ["id", "object", "date", "customer_id", "tracking_id", "metadata", "amount", "redemption", "result", "status", "related_redemptions", "failure_code", "failure_message", "order", "channel", "customer", "related_object_type", "related_object_id", "voucher", "promotion_tier", "reward", "gift", "loyalty_card"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption']): + raise ValueError("must be one of enum values ('redemption')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCEEDED', 'FAILED', 'ROLLED_BACK']): + raise ValueError("must be one of enum values ('SUCCEEDED', 'FAILED', 'ROLLED_BACK')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'redemption']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'redemption')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBody 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 related_redemptions + if self.related_redemptions: + _dict['related_redemptions'] = self.related_redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of channel + if self.channel: + _dict['channel'] = self.channel.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion_tier + if self.promotion_tier: + _dict['promotion_tier'] = self.promotion_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if var_date (nullable) is None + # and model_fields_set contains the field + if self.var_date is None and "var_date" in self.model_fields_set: + _dict['date'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if related_redemptions (nullable) is None + # and model_fields_set contains the field + if self.related_redemptions is None and "related_redemptions" in self.model_fields_set: + _dict['related_redemptions'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if voucher (nullable) is None + # and model_fields_set contains the field + if self.voucher is None and "voucher" in self.model_fields_set: + _dict['voucher'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'redemption', + "date": obj.get("date"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "amount": obj.get("amount"), + "redemption": obj.get("redemption"), + "result": obj.get("result"), + "status": obj.get("status"), + "related_redemptions": LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions.from_dict(obj["related_redemptions"]) if obj.get("related_redemptions") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "channel": LoyaltiesMembersRedemptionRedeemResponseBodyChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, + "customer": SimpleCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "related_object_type": obj.get("related_object_type"), + "related_object_id": obj.get("related_object_id"), + "voucher": LoyaltiesMembersRedemptionRedeemResponseBodyVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "promotion_tier": PromotionTier.from_dict(obj["promotion_tier"]) if obj.get("promotion_tier") is not None else None, + "reward": RedemptionRewardResult.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "gift": LoyaltiesMembersRedemptionRedeemResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_channel.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_channel.py new file mode 100644 index 00000000..18414ff9 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_channel.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyChannel(BaseModel): + """ + Defines the details of the channel through which the redemption was issued. + """ # noqa: E501 + channel_id: Optional[StrictStr] = Field(default=None, description="Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API.") + channel_type: Optional[StrictStr] = Field(default=None, description="The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.") + __properties: ClassVar[List[str]] = ["channel_id", "channel_type"] + + @field_validator('channel_type') + def channel_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['USER', 'API']): + raise ValueError("must be one of enum values ('USER', 'API')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyChannel 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, + ) + # set to None if channel_id (nullable) is None + # and model_fields_set contains the field + if self.channel_id is None and "channel_id" in self.model_fields_set: + _dict['channel_id'] = None + + # set to None if channel_type (nullable) is None + # and model_fields_set contains the field + if self.channel_type is None and "channel_type" in self.model_fields_set: + _dict['channel_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyChannel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel_id": obj.get("channel_id"), + "channel_type": obj.get("channel_type") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_gift.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_gift.py new file mode 100644 index 00000000..a33d601b --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyGift(BaseModel): + """ + Contains the amount subtracted from the gift card for the redemption. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_loyalty_card.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_loyalty_card.py new file mode 100644 index 00000000..75b374f2 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard(BaseModel): + """ + Contains the number of points subtracted from the loyalty card for the redemption. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points subtracted from the loyalty card as a result of the redemption.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions.py new file mode 100644 index 00000000..5945476c --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item import LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions(BaseModel): + """ + LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions + """ # noqa: E501 + rollbacks: Optional[List[LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem]] = None + redemptions: Optional[List[LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem]] = None + __properties: ClassVar[List[str]] = ["rollbacks", "redemptions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if rollbacks (nullable) is None + # and model_fields_set contains the field + if self.rollbacks is None and "rollbacks" in self.model_fields_set: + _dict['rollbacks'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "redemptions": [LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item.py new file mode 100644 index 00000000..7e794e55 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions_redemptions_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem(BaseModel): + """ + LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem 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 LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRedemptionsItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item.py new file mode 100644 index 00000000..af1c33c3 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_related_redemptions_rollbacks_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem(BaseModel): + """ + LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique rollback redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem 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 LoyaltiesMembersRedemptionRedeemResponseBodyRelatedRedemptionsRollbacksItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher.py new file mode 100644 index 00000000..6d6b49ae --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_gift import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_loyalty_card import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_publish import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish +from voucherify.models.loyalties_members_redemption_redeem_response_body_voucher_redemption import LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucher(BaseModel): + """ + Defines the details of the voucher being redeemed. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift] = None + loyalty_card: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish] = None + redemption: Optional[LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + holder: Optional[SimpleCustomer] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments", "holder"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of holder + if self.holder: + _dict['holder'] = self.holder.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucher 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "holder": SimpleCustomer.from_dict(obj["holder"]) if obj.get("holder") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_gift.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_gift.py new file mode 100644 index 00000000..41ae1776 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.py new file mode 100644 index 00000000..5be244cd --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_publish.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_publish.py new file mode 100644 index 00000000..0511ba82 --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_redemption.py b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_redemption.py new file mode 100644 index 00000000..2638ba3a --- /dev/null +++ b/voucherify/models/loyalties_members_redemption_redeem_response_body_voucher_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRedemptionRedeemResponseBodyVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_rewards_list_response_body.py b/voucherify/models/loyalties_members_rewards_list_response_body.py new file mode 100644 index 00000000..08d8fc64 --- /dev/null +++ b/voucherify/models/loyalties_members_rewards_list_response_body.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_members_rewards_list_response_body_data_item import LoyaltiesMembersRewardsListResponseBodyDataItem +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRewardsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/members/{memberId}/rewards` + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of loyalty reward objects.") + data: Optional[List[LoyaltiesMembersRewardsListResponseBodyDataItem]] = Field(default=None, description="Contains array of loyalty reward objects.") + total: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Total number of loyalty reward objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRewardsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRewardsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [LoyaltiesMembersRewardsListResponseBodyDataItem.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_rewards_list_response_body_data_item.py b/voucherify/models/loyalties_members_rewards_list_response_body_data_item.py new file mode 100644 index 00000000..bac098f7 --- /dev/null +++ b/voucherify/models/loyalties_members_rewards_list_response_body_data_item.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.reward import Reward +from voucherify.models.reward_assignment import RewardAssignment +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersRewardsListResponseBodyDataItem(BaseModel): + """ + LoyaltiesMembersRewardsListResponseBodyDataItem + """ # noqa: E501 + reward: Optional[Reward] = None + assignment: Optional[RewardAssignment] = None + object: Optional[StrictStr] = Field(default='loyalty_reward', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["reward", "assignment", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['loyalty_reward']): + raise ValueError("must be one of enum values ('loyalty_reward')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRewardsListResponseBodyDataItem 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 reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of assignment + if self.assignment: + _dict['assignment'] = self.assignment.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersRewardsListResponseBodyDataItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reward": Reward.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "assignment": RewardAssignment.from_dict(obj["assignment"]) if obj.get("assignment") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'loyalty_reward' + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_tiers_list_response_body.py b/voucherify/models/loyalties_members_tiers_list_response_body.py new file mode 100644 index 00000000..d67084af --- /dev/null +++ b/voucherify/models/loyalties_members_tiers_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalty_tier import LoyaltyTier +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTiersListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/members/{memberId}/tiers`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of loyalty tier objects.") + data: Optional[List[LoyaltyTier]] = None + total: Optional[StrictInt] = Field(default=None, description="Total number of loyalty tier objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTiersListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTiersListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [LoyaltyTier.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transactions_export_create_request_body.py b/voucherify/models/loyalties_members_transactions_export_create_request_body.py new file mode 100644 index 00000000..e63f99ef --- /dev/null +++ b/voucherify/models/loyalties_members_transactions_export_create_request_body.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_members_transactions_export_create_request_body_parameters import LoyaltiesMembersTransactionsExportCreateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransactionsExportCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/loyalties/members/{memberId}/transactions/export` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transactions/export`. + """ # noqa: E501 + parameters: Optional[LoyaltiesMembersTransactionsExportCreateRequestBodyParameters] = None + __properties: ClassVar[List[str]] = ["parameters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parameters": LoyaltiesMembersTransactionsExportCreateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transactions_export_create_request_body_parameters.py b/voucherify/models/loyalties_members_transactions_export_create_request_body_parameters.py new file mode 100644 index 00000000..6e7e2dca --- /dev/null +++ b/voucherify/models/loyalties_members_transactions_export_create_request_body_parameters.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.export_voucher_transactions_fields import ExportVoucherTransactionsFields +from voucherify.models.export_voucher_transactions_filters import ExportVoucherTransactionsFilters +from voucherify.models.export_voucher_transactions_order import ExportVoucherTransactionsOrder +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransactionsExportCreateRequestBodyParameters(BaseModel): + """ + List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + """ # noqa: E501 + order: Optional[ExportVoucherTransactionsOrder] = None + fields: Optional[List[ExportVoucherTransactionsFields]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[ExportVoucherTransactionsFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateRequestBodyParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": ExportVoucherTransactionsFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transactions_export_create_response_body.py b/voucherify/models/loyalties_members_transactions_export_create_response_body.py new file mode 100644 index 00000000..af95130d --- /dev/null +++ b/voucherify/models/loyalties_members_transactions_export_create_response_body.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_members_transactions_export_create_response_body_parameters import LoyaltiesMembersTransactionsExportCreateResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransactionsExportCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/loyalties/members/{memberId}/transactions/export` and for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transactions/export`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique export ID.") + object: Optional[StrictStr] = Field(default='export', description="The type of object being represented. This object stores information about the export.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the export was scheduled in ISO 8601 format.") + status: Optional[StrictStr] = Field(default='SCHEDULED', description="Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.") + channel: Optional[StrictStr] = Field(default=None, description="The channel through which the export was triggered.") + result: Optional[Dict[str, Any]] = Field(default=None, description="Contains the URL of the CSV file.") + user_id: Optional[StrictStr] = Field(default=None, description="Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.") + exported_object: Optional[StrictStr] = Field(default='voucher_transactions', description="The type of object to be exported.") + parameters: Optional[LoyaltiesMembersTransactionsExportCreateResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "status", "channel", "result", "user_id", "exported_object", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['export']): + raise ValueError("must be one of enum values ('export')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SCHEDULED']): + raise ValueError("must be one of enum values ('SCHEDULED')") + return value + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher_transactions']): + raise ValueError("must be one of enum values ('voucher_transactions')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'export', + "created_at": obj.get("created_at"), + "status": obj.get("status") if obj.get("status") is not None else 'SCHEDULED', + "channel": obj.get("channel"), + "result": obj.get("result"), + "user_id": obj.get("user_id"), + "exported_object": obj.get("exported_object") if obj.get("exported_object") is not None else 'voucher_transactions', + "parameters": LoyaltiesMembersTransactionsExportCreateResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transactions_export_create_response_body_parameters.py b/voucherify/models/loyalties_members_transactions_export_create_response_body_parameters.py new file mode 100644 index 00000000..5c44ef3c --- /dev/null +++ b/voucherify/models/loyalties_members_transactions_export_create_response_body_parameters.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.export_voucher_transactions_fields import ExportVoucherTransactionsFields +from voucherify.models.export_voucher_transactions_filters import ExportVoucherTransactionsFilters +from voucherify.models.export_voucher_transactions_order import ExportVoucherTransactionsOrder +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransactionsExportCreateResponseBodyParameters(BaseModel): + """ + List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + """ # noqa: E501 + order: Optional[ExportVoucherTransactionsOrder] = None + fields: Optional[List[ExportVoucherTransactionsFields]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[ExportVoucherTransactionsFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateResponseBodyParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsExportCreateResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": ExportVoucherTransactionsFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transactions_list_response_body.py b/voucherify/models/loyalties_members_transactions_list_response_body.py new file mode 100644 index 00000000..75d17480 --- /dev/null +++ b/voucherify/models/loyalties_members_transactions_list_response_body.py @@ -0,0 +1,170 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.loyalty_card_transaction import LoyaltyCardTransaction +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransactionsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/members/{memberId}/transactions` and `/loyalties/members/{memberId}/transactions`. + """ # noqa: E501 + object: Optional[Annotated[str, Field(strict=True)]] = Field(default='list', description="The type of the object represented by JSON.") + data_ref: Optional[Annotated[str, Field(strict=True)]] = Field(default='data', description="Identifies the name of the attribute that contains the array of transaction objects.") + data: Optional[List[LoyaltyCardTransaction]] = Field(default=None, description="A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results.") + more_starting_after: Optional[StrictStr] = Field(default=None, description="Returns an ID that can be used to return another page of results. Use the transaction ID in the `starting_after_id` query parameter to display another page of the results starting after the transaction with that ID.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "has_more", "more_starting_after"] + + @field_validator('object') + def object_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"list", value): + raise ValueError(r"must validate the regular expression /list/") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"data", value): + raise ValueError(r"must validate the regular expression /data/") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + # set to None if more_starting_after (nullable) is None + # and model_fields_set contains the field + if self.more_starting_after is None and "more_starting_after" in self.model_fields_set: + _dict['more_starting_after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransactionsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [LoyaltyCardTransaction.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "more_starting_after": obj.get("more_starting_after") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transfers_create_response_body.py b/voucherify/models/loyalties_members_transfers_create_response_body.py new file mode 100644 index 00000000..1c03923f --- /dev/null +++ b/voucherify/models/loyalties_members_transfers_create_response_body.py @@ -0,0 +1,290 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.loyalties_members_transfers_create_response_body_assets import LoyaltiesMembersTransfersCreateResponseBodyAssets +from voucherify.models.loyalties_members_transfers_create_response_body_loyalty_card import LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard +from voucherify.models.loyalties_members_transfers_create_response_body_publish import LoyaltiesMembersTransfersCreateResponseBodyPublish +from voucherify.models.loyalties_members_transfers_create_response_body_redemption import LoyaltiesMembersTransfersCreateResponseBodyRedemption +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransfersCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/loyalties/{campaignId}/members/{memberId}/transfers`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + categories: Optional[List[Category]] = None + type: Optional[StrictStr] = Field(default='LOYALTY_CARD', description="Defines the type of the voucher.") + loyalty_card: Optional[LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.") + validity_timeframe: ValidityTimeframe + validity_day_of_week: List[StrictInt] = Field(description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + publish: Optional[LoyaltiesMembersTransfersCreateResponseBodyPublish] = None + redemption: Optional[LoyaltiesMembersTransfersCreateResponseBodyRedemption] = None + active: Optional[StrictStr] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date. - `true` indicates an active voucher - `false` indicates an inactive voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[LoyaltiesMembersTransfersCreateResponseBodyAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + created_at: Optional[datetime] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "categories", "type", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "publish", "redemption", "active", "additional_info", "metadata", "assets", "is_referral_code", "holder_id", "updated_at", "created_at"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD']): + raise ValueError("must be one of enum values ('LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBody 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 categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if assets (nullable) is None + # and model_fields_set contains the field + if self.assets is None and "assets" in self.model_fields_set: + _dict['assets'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "type": obj.get("type") if obj.get("type") is not None else 'LOYALTY_CARD', + "loyalty_card": LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "publish": LoyaltiesMembersTransfersCreateResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": LoyaltiesMembersTransfersCreateResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": LoyaltiesMembersTransfersCreateResponseBodyAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "holder_id": obj.get("holder_id"), + "updated_at": obj.get("updated_at"), + "created_at": obj.get("created_at") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transfers_create_response_body_assets.py b/voucherify/models/loyalties_members_transfers_create_response_body_assets.py new file mode 100644 index 00000000..dd01ab1d --- /dev/null +++ b/voucherify/models/loyalties_members_transfers_create_response_body_assets.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_members_transfers_create_response_body_assets_barcode import LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode +from voucherify.models.loyalties_members_transfers_create_response_body_assets_qr import LoyaltiesMembersTransfersCreateResponseBodyAssetsQr +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransfersCreateResponseBodyAssets(BaseModel): + """ + Stores links to images of QR and barcode that correspond to an encrypted voucher code. + """ # noqa: E501 + qr: Optional[LoyaltiesMembersTransfersCreateResponseBodyAssetsQr] = None + barcode: Optional[LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode] = None + __properties: ClassVar[List[str]] = ["qr", "barcode"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyAssets 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 qr + if self.qr: + _dict['qr'] = self.qr.to_dict() + # override the default output from pydantic by calling `to_dict()` of barcode + if self.barcode: + _dict['barcode'] = self.barcode.to_dict() + # set to None if qr (nullable) is None + # and model_fields_set contains the field + if self.qr is None and "qr" in self.model_fields_set: + _dict['qr'] = None + + # set to None if barcode (nullable) is None + # and model_fields_set contains the field + if self.barcode is None and "barcode" in self.model_fields_set: + _dict['barcode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyAssets from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "qr": LoyaltiesMembersTransfersCreateResponseBodyAssetsQr.from_dict(obj["qr"]) if obj.get("qr") is not None else None, + "barcode": LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode.from_dict(obj["barcode"]) if obj.get("barcode") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transfers_create_response_body_assets_barcode.py b/voucherify/models/loyalties_members_transfers_create_response_body_assets_barcode.py new file mode 100644 index 00000000..74ad8f6f --- /dev/null +++ b/voucherify/models/loyalties_members_transfers_create_response_body_assets_barcode.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode(BaseModel): + """ + Stores barcode representation of encrypted code. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Encrypted voucher code ID.") + url: Optional[StrictStr] = Field(default=None, description="URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg`") + __properties: ClassVar[List[str]] = ["id", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyAssetsBarcode 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"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transfers_create_response_body_assets_qr.py b/voucherify/models/loyalties_members_transfers_create_response_body_assets_qr.py new file mode 100644 index 00000000..398d4437 --- /dev/null +++ b/voucherify/models/loyalties_members_transfers_create_response_body_assets_qr.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransfersCreateResponseBodyAssetsQr(BaseModel): + """ + Stores Quick Response (QR) representation of encrypted code. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Encrypted voucher code ID.") + url: Optional[StrictStr] = Field(default=None, description="URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg`") + __properties: ClassVar[List[str]] = ["id", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyAssetsQr 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyAssetsQr 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"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transfers_create_response_body_loyalty_card.py b/voucherify/models/loyalties_members_transfers_create_response_body_loyalty_card.py new file mode 100644 index 00000000..70864c0b --- /dev/null +++ b/voucherify/models/loyalties_members_transfers_create_response_body_loyalty_card.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[StrictStr] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transfers_create_response_body_publish.py b/voucherify/models/loyalties_members_transfers_create_response_body_publish.py new file mode 100644 index 00000000..7250de2e --- /dev/null +++ b/voucherify/models/loyalties_members_transfers_create_response_body_publish.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesMembersTransfersCreateResponseBodyPublish(BaseModel): + """ + This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + entries: Optional[List[StrictStr]] = None + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications") + __properties: ClassVar[List[str]] = ["object", "count", "entries", "url"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if entries (nullable) is None + # and model_fields_set contains the field + if self.entries is None and "entries" in self.model_fields_set: + _dict['entries'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "entries": obj.get("entries"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_members_transfers_create_response_body_redemption.py b/voucherify/models/loyalties_members_transfers_create_response_body_redemption.py new file mode 100644 index 00000000..0bbcddb1 --- /dev/null +++ b/voucherify/models/loyalties_members_transfers_create_response_body_redemption.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltiesMembersTransfersCreateResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A null value means unlimited.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_points", "redeemed_quantity", "object", "url"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesMembersTransfersCreateResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_points": obj.get("redeemed_points"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_request_body.py b/voucherify/models/loyalties_points_expiration_export_create_request_body.py new file mode 100644 index 00000000..ad3228c8 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_request_body.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters import LoyaltiesPointsExpirationExportCreateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateRequestBody(BaseModel): + """ + Request schema model for validating a voucher using **POST** `/v1/loyalties/{campaignId}/points-expiration/export` + """ # noqa: E501 + parameters: Optional[LoyaltiesPointsExpirationExportCreateRequestBodyParameters] = None + __properties: ClassVar[List[str]] = ["parameters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parameters": LoyaltiesPointsExpirationExportCreateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters.py b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters.py new file mode 100644 index 00000000..a1776e54 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateRequestBodyParameters(BaseModel): + """ + List of fields and filters that will be used to create the export. + """ # noqa: E501 + order: Optional[StrictStr] = Field(default=None, description="How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.") + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 |") + filters: Optional[LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expires_at', '-expires_at']): + raise ValueError("must be one of enum values ('expires_at', '-expires_at')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['id', 'campaign_id', 'voucher_id', 'points', 'status', 'expires_at']): + raise ValueError("each list item must be one of ('id', 'campaign_id', 'voucher_id', 'points', 'status', 'expires_at')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters.py b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters.py new file mode 100644 index 00000000..e93e55ba --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the export. + """ # noqa: E501 + junction: Optional[Junction] = None + voucher_id: Optional[LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId] = None + campaign_id: Optional[LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId] = None + __properties: ClassVar[List[str]] = ["junction", "voucher_id", "campaign_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters 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 voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # set to None if voucher_id (nullable) is None + # and model_fields_set contains the field + if self.voucher_id is None and "voucher_id" in self.model_fields_set: + _dict['voucher_id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "voucher_id": LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None, + "campaign_id": LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id.py b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id.py new file mode 100644 index 00000000..3699f583 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + conditions: Optional[LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions.py b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions.py new file mode 100644 index 00000000..dde3983f --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_campaign_id_conditions.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be included in the results.", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be included in the results.", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Specify the exact resource value.", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results should omit this value.", alias="$is_not") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersCampaignIdConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not") + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id.py b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id.py new file mode 100644 index 00000000..2b677839 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions import LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + conditions: Optional[LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions.py b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions.py new file mode 100644 index 00000000..c306cf26 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_request_body_parameters_filters_voucher_id_conditions.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be included in the results.", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be included in the results.", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Specify the exact resource value.", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results should omit this value.", alias="$is_not") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateRequestBodyParametersFiltersVoucherIdConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not") + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_response_body.py b/voucherify/models/loyalties_points_expiration_export_create_response_body.py new file mode 100644 index 00000000..6588555c --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_response_body.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters import LoyaltiesPointsExpirationExportCreateResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateResponseBody(BaseModel): + """ + Object representing an export of points expirations. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique export ID.") + object: Optional[StrictStr] = Field(default='export', description="The type of object being represented. This object stores information about the export.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the export was scheduled in ISO 8601 format.") + status: Optional[StrictStr] = Field(default='SCHEDULED', description="Status of the export. Informs you whether the export has already been completed.") + channel: Optional[StrictStr] = Field(default=None, description="The channel through which the export was triggered.") + exported_object: Optional[StrictStr] = Field(default='points_expiration', description="The type of exported object.") + parameters: Optional[LoyaltiesPointsExpirationExportCreateResponseBodyParameters] = None + result: Optional[Dict[str, Any]] = Field(default=None, description="Always null.") + user_id: Optional[StrictStr] = Field(default=None, description="`user_id` identifies the specific user who initiated the export through the Voucherify Dashboard. `user_id` is returned when the channel value is `WEBSITE`.") + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "status", "channel", "exported_object", "parameters", "result", "user_id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['export']): + raise ValueError("must be one of enum values ('export')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SCHEDULED']): + raise ValueError("must be one of enum values ('SCHEDULED')") + return value + + @field_validator('channel') + def channel_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['API', 'WEBSITE']): + raise ValueError("must be one of enum values ('API', 'WEBSITE')") + return value + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['points_expiration']): + raise ValueError("must be one of enum values ('points_expiration')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'export', + "created_at": obj.get("created_at"), + "status": obj.get("status") if obj.get("status") is not None else 'SCHEDULED', + "channel": obj.get("channel"), + "exported_object": obj.get("exported_object") if obj.get("exported_object") is not None else 'points_expiration', + "parameters": LoyaltiesPointsExpirationExportCreateResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "result": obj.get("result"), + "user_id": obj.get("user_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters.py b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters.py new file mode 100644 index 00000000..6f47fc40 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateResponseBodyParameters(BaseModel): + """ + List of fields and filters that were passed in the request body to create the export. + """ # noqa: E501 + order: Optional[StrictStr] = Field(default=None, description="How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.") + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data that was exported. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n | | campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic | | voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 | | status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` | | expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 | | points | Number of points. | 1000 |") + filters: Optional[LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters] = None + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expires_at', '-expires_at']): + raise ValueError("must be one of enum values ('expires_at', '-expires_at')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['id', 'campaign_id', 'voucher_id', 'points', 'status', 'expires_at']): + raise ValueError("each list item must be one of ('id', 'campaign_id', 'voucher_id', 'points', 'status', 'expires_at')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParameters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters.py b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters.py new file mode 100644 index 00000000..bab89625 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the export. + """ # noqa: E501 + junction: Optional[Junction] = None + voucher_id: Optional[LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId] = None + campaign_id: Optional[LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId] = None + __properties: ClassVar[List[str]] = ["junction", "voucher_id", "campaign_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters 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 voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # set to None if voucher_id (nullable) is None + # and model_fields_set contains the field + if self.voucher_id is None and "voucher_id" in self.model_fields_set: + _dict['voucher_id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "voucher_id": LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None, + "campaign_id": LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id.py b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id.py new file mode 100644 index 00000000..a8088041 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + conditions: Optional[LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions.py b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions.py new file mode 100644 index 00000000..e5e26b68 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_campaign_id_conditions.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be included in the results.", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be included in the results.", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Specify the exact resource value.", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results should omit this value.", alias="$is_not") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersCampaignIdConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not") + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id.py b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id.py new file mode 100644 index 00000000..1c43d935 --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions import LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + conditions: Optional[LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions.py b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions.py new file mode 100644 index 00000000..b7dc6bac --- /dev/null +++ b/voucherify/models/loyalties_points_expiration_export_create_response_body_parameters_filters_voucher_id_conditions.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be included in the results.", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of the resource values that should be excluded from the results.", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Specify the exact resource value.", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results should omit this value.", alias="$is_not") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesPointsExpirationExportCreateResponseBodyParametersFiltersVoucherIdConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not") + }) + return _obj + + diff --git a/voucherify/models/loyalties_reward_assignments_get_response_body.py b/voucherify/models/loyalties_reward_assignments_get_response_body.py new file mode 100644 index 00000000..e30ec0e1 --- /dev/null +++ b/voucherify/models/loyalties_reward_assignments_get_response_body.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_reward_assignments_get_response_body_parameters import LoyaltiesRewardAssignmentsGetResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardAssignmentsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments/{assignmentId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[LoyaltiesRewardAssignmentsGetResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsGetResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsGetResponseBody 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": LoyaltiesRewardAssignmentsGetResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_reward_assignments_get_response_body_parameters.py b/voucherify/models/loyalties_reward_assignments_get_response_body_parameters.py new file mode 100644 index 00000000..9a49276f --- /dev/null +++ b/voucherify/models/loyalties_reward_assignments_get_response_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_reward_assignments_get_response_body_parameters_loyalty import LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardAssignmentsGetResponseBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsGetResponseBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsGetResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_reward_assignments_get_response_body_parameters_loyalty.py b/voucherify/models/loyalties_reward_assignments_get_response_body_parameters_loyalty.py new file mode 100644 index 00000000..1d463bb8 --- /dev/null +++ b/voucherify/models/loyalties_reward_assignments_get_response_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_reward_assignments_list_response_body.py b/voucherify/models/loyalties_reward_assignments_list_response_body.py new file mode 100644 index 00000000..042c6382 --- /dev/null +++ b/voucherify/models/loyalties_reward_assignments_list_response_body.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.reward_assignment import RewardAssignment +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardAssignmentsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of reward assignment objects.") + data: Optional[List[RewardAssignment]] = Field(default=None, description="Contains array of reward assignment objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of reward assignment objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [RewardAssignment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_reward_assignments_reward_get_response_body.py b/voucherify/models/loyalties_reward_assignments_reward_get_response_body.py new file mode 100644 index 00000000..7d0e2e5c --- /dev/null +++ b/voucherify/models/loyalties_reward_assignments_reward_get_response_body.py @@ -0,0 +1,179 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalties_reward_assignments_reward_get_response_body_attributes import LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes +from voucherify.models.reward_type import RewardType +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardAssignmentsRewardGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward` + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + stock: Optional[StrictInt] = Field(default=None, description="Configurable for **material rewards**. The number of units of the product that you want to share as reward.") + redeemed: Optional[StrictInt] = Field(default=None, description="Defines the number of already invoked (successful) reward redemptions. ") + attributes: Optional[LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format.") + type: Optional[StrictStr] = Field(default=None, description="Reward type.") + parameters: Optional[RewardType] = None + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format.") + object: StrictStr = Field(description="The type of the object represented by the JSON. This object stores information about the reward.") + __properties: ClassVar[List[str]] = ["id", "name", "stock", "redeemed", "attributes", "metadata", "type", "parameters", "created_at", "updated_at", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CAMPAIGN', 'COIN', 'MATERIAL']): + raise ValueError("must be one of enum values ('CAMPAIGN', 'COIN', 'MATERIAL')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['reward']): + raise ValueError("must be one of enum values ('reward')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsRewardGetResponseBody 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 attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if stock (nullable) is None + # and model_fields_set contains the field + if self.stock is None and "stock" in self.model_fields_set: + _dict['stock'] = None + + # set to None if redeemed (nullable) is None + # and model_fields_set contains the field + if self.redeemed is None and "redeemed" in self.model_fields_set: + _dict['redeemed'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsRewardGetResponseBody 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"), + "name": obj.get("name"), + "stock": obj.get("stock"), + "redeemed": obj.get("redeemed"), + "attributes": LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": obj.get("metadata"), + "type": obj.get("type"), + "parameters": RewardType.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward' + }) + return _obj + + diff --git a/voucherify/models/loyalties_reward_assignments_reward_get_response_body_attributes.py b/voucherify/models/loyalties_reward_assignments_reward_get_response_body_attributes.py new file mode 100644 index 00000000..df8f3d3a --- /dev/null +++ b/voucherify/models/loyalties_reward_assignments_reward_get_response_body_attributes.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes(BaseModel): + """ + These properties are configurable for **material rewards**. + """ # noqa: E501 + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a material reward.") + __properties: ClassVar[List[str]] = ["image_url", "description"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes 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, + ) + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardAssignmentsRewardGetResponseBodyAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "image_url": obj.get("image_url"), + "description": obj.get("description") + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_create_assignment_item_request_body.py b/voucherify/models/loyalties_rewards_create_assignment_item_request_body.py new file mode 100644 index 00000000..bf922353 --- /dev/null +++ b/voucherify/models/loyalties_rewards_create_assignment_item_request_body.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_create_assignment_item_request_body_parameters import LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsCreateAssignmentItemRequestBody(BaseModel): + """ + LoyaltiesRewardsCreateAssignmentItemRequestBody + """ # noqa: E501 + reward: Optional[StrictStr] = Field(default=None, description="The ID of the reward that will be assigned to the campaign.") + parameters: Optional[LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters] = None + validation_rules: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["reward", "parameters", "validation_rules"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentItemRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + # set to None if validation_rules (nullable) is None + # and model_fields_set contains the field + if self.validation_rules is None and "validation_rules" in self.model_fields_set: + _dict['validation_rules'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentItemRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reward": obj.get("reward"), + "parameters": LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "validation_rules": obj.get("validation_rules") + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_create_assignment_item_request_body_parameters.py b/voucherify/models/loyalties_rewards_create_assignment_item_request_body_parameters.py new file mode 100644 index 00000000..e9178303 --- /dev/null +++ b/voucherify/models/loyalties_rewards_create_assignment_item_request_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_create_assignment_item_request_body_parameters_loyalty import LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentItemRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_create_assignment_item_request_body_parameters_loyalty.py b/voucherify/models/loyalties_rewards_create_assignment_item_request_body_parameters_loyalty.py new file mode 100644 index 00000000..3098c7d7 --- /dev/null +++ b/voucherify/models/loyalties_rewards_create_assignment_item_request_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentItemRequestBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_create_assignment_response_body.py b/voucherify/models/loyalties_rewards_create_assignment_response_body.py new file mode 100644 index 00000000..5dde141c --- /dev/null +++ b/voucherify/models/loyalties_rewards_create_assignment_response_body.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_create_assignment_response_body_parameters import LoyaltiesRewardsCreateAssignmentResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsCreateAssignmentResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/v1/loyalties/{campaignId}/rewards`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[LoyaltiesRewardsCreateAssignmentResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentResponseBody 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": LoyaltiesRewardsCreateAssignmentResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_create_assignment_response_body_parameters.py b/voucherify/models/loyalties_rewards_create_assignment_response_body_parameters.py new file mode 100644 index 00000000..adaaa48e --- /dev/null +++ b/voucherify/models/loyalties_rewards_create_assignment_response_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_create_assignment_response_body_parameters_loyalty import LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsCreateAssignmentResponseBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentResponseBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty.py b/voucherify/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty.py new file mode 100644 index 00000000..6efe0f55 --- /dev/null +++ b/voucherify/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_get_response_body.py b/voucherify/models/loyalties_rewards_get_response_body.py new file mode 100644 index 00000000..a840a501 --- /dev/null +++ b/voucherify/models/loyalties_rewards_get_response_body.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_get_response_body_parameters import LoyaltiesRewardsGetResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/rewards/{assignmentId}` + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[LoyaltiesRewardsGetResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsGetResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsGetResponseBody 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": LoyaltiesRewardsGetResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_get_response_body_parameters.py b/voucherify/models/loyalties_rewards_get_response_body_parameters.py new file mode 100644 index 00000000..36860105 --- /dev/null +++ b/voucherify/models/loyalties_rewards_get_response_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_get_response_body_parameters_loyalty import LoyaltiesRewardsGetResponseBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsGetResponseBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[LoyaltiesRewardsGetResponseBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsGetResponseBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsGetResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": LoyaltiesRewardsGetResponseBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_get_response_body_parameters_loyalty.py b/voucherify/models/loyalties_rewards_get_response_body_parameters_loyalty.py new file mode 100644 index 00000000..3e7dabaf --- /dev/null +++ b/voucherify/models/loyalties_rewards_get_response_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsGetResponseBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsGetResponseBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsGetResponseBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_list_assignments_response_body.py b/voucherify/models/loyalties_rewards_list_assignments_response_body.py new file mode 100644 index 00000000..72f6f175 --- /dev/null +++ b/voucherify/models/loyalties_rewards_list_assignments_response_body.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.reward_assignment import RewardAssignment +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsListAssignmentsResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/rewards`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about loyalty reward assignments in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of reward assignment objects.") + data: Optional[List[RewardAssignment]] = Field(default=None, description="Contains array of reward assignment objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of reward assignment objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsListAssignmentsResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsListAssignmentsResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [RewardAssignment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_update_assignment_request_body.py b/voucherify/models/loyalties_rewards_update_assignment_request_body.py new file mode 100644 index 00000000..36e8cec9 --- /dev/null +++ b/voucherify/models/loyalties_rewards_update_assignment_request_body.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_update_assignment_request_body_parameters import LoyaltiesRewardsUpdateAssignmentRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsUpdateAssignmentRequestBody(BaseModel): + """ + Response body schema for **PUT** `v1/v1/loyalties/{campaignId}/rewards/{assignmentId}`. + """ # noqa: E501 + parameters: Optional[LoyaltiesRewardsUpdateAssignmentRequestBodyParameters] = None + __properties: ClassVar[List[str]] = ["parameters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parameters": LoyaltiesRewardsUpdateAssignmentRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_update_assignment_request_body_parameters.py b/voucherify/models/loyalties_rewards_update_assignment_request_body_parameters.py new file mode 100644 index 00000000..042c7071 --- /dev/null +++ b/voucherify/models/loyalties_rewards_update_assignment_request_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_update_assignment_request_body_parameters_loyalty import LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsUpdateAssignmentRequestBodyParameters(BaseModel): + """ + An object that defines the price of the reward in loyalty points. + """ # noqa: E501 + loyalty: Optional[LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentRequestBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty.py b/voucherify/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty.py new file mode 100644 index 00000000..0fcaac13 --- /dev/null +++ b/voucherify/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty(BaseModel): + """ + Stores the points parameter. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Defines how many points are required to obtain the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_update_assignment_response_body.py b/voucherify/models/loyalties_rewards_update_assignment_response_body.py new file mode 100644 index 00000000..822c2497 --- /dev/null +++ b/voucherify/models/loyalties_rewards_update_assignment_response_body.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_update_assignment_response_body_parameters import LoyaltiesRewardsUpdateAssignmentResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsUpdateAssignmentResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/v1/loyalties/{campaignId}/rewards/{assignmentId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[LoyaltiesRewardsUpdateAssignmentResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentResponseBody 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": LoyaltiesRewardsUpdateAssignmentResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_update_assignment_response_body_parameters.py b/voucherify/models/loyalties_rewards_update_assignment_response_body_parameters.py new file mode 100644 index 00000000..586a4137 --- /dev/null +++ b/voucherify/models/loyalties_rewards_update_assignment_response_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_rewards_update_assignment_response_body_parameters_loyalty import LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsUpdateAssignmentResponseBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentResponseBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty.py b/voucherify/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty.py new file mode 100644 index 00000000..c1f6e168 --- /dev/null +++ b/voucherify/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_create_in_bulk_request_body_item.py b/voucherify/models/loyalties_tiers_create_in_bulk_request_body_item.py new file mode 100644 index 00000000..6114b08d --- /dev/null +++ b/voucherify/models/loyalties_tiers_create_in_bulk_request_body_item.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_tier_base_points import LoyaltyTierBasePoints +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersCreateInBulkRequestBodyItem(BaseModel): + """ + LoyaltiesTiersCreateInBulkRequestBodyItem + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Loyalty Tier name.") + earning_rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of earning rule IDs and their points mapping for the given earning rule.") + rewards: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of reward IDs and their points mapping for the given reward.") + points: Optional[LoyaltyTierBasePoints] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.") + __properties: ClassVar[List[str]] = ["name", "earning_rules", "rewards", "points", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersCreateInBulkRequestBodyItem 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 points + if self.points: + _dict['points'] = self.points.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if earning_rules (nullable) is None + # and model_fields_set contains the field + if self.earning_rules is None and "earning_rules" in self.model_fields_set: + _dict['earning_rules'] = None + + # set to None if rewards (nullable) is None + # and model_fields_set contains the field + if self.rewards is None and "rewards" in self.model_fields_set: + _dict['rewards'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersCreateInBulkRequestBodyItem 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"), + "earning_rules": obj.get("earning_rules"), + "rewards": obj.get("rewards"), + "points": LoyaltyTierBasePoints.from_dict(obj["points"]) if obj.get("points") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_earning_rules_list_response_body.py b/voucherify/models/loyalties_tiers_earning_rules_list_response_body.py new file mode 100644 index 00000000..d15e6e6d --- /dev/null +++ b/voucherify/models/loyalties_tiers_earning_rules_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.earning_rule import EarningRule +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersEarningRulesListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about earning rules in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of earning rule objects.") + data: Optional[List[EarningRule]] = Field(default=None, description="Contains array of earning rule objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of earning rule objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersEarningRulesListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersEarningRulesListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [EarningRule.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_get_response_body.py b/voucherify/models/loyalties_tiers_get_response_body.py new file mode 100644 index 00000000..1ae9d194 --- /dev/null +++ b/voucherify/models/loyalties_tiers_get_response_body.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_tiers_get_response_body_config import LoyaltiesTiersGetResponseBodyConfig +from voucherify.models.loyalties_tiers_get_response_body_points import LoyaltiesTiersGetResponseBodyPoints +from voucherify.models.loyalty_tier_expiration import LoyaltyTierExpiration +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Loyalty Tier name.") + earning_rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of earning rule IDs and their points mapping for the given earning rule.") + rewards: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of reward IDs and their points mapping for the given reward.") + points: Optional[LoyaltiesTiersGetResponseBodyPoints] = None + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Unique parent campaign ID.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format.") + config: Optional[LoyaltiesTiersGetResponseBodyConfig] = None + expiration: Optional[LoyaltyTierExpiration] = None + object: Optional[StrictStr] = Field(default='loyalty_tier', description="The type of the object represented by JSON. This object stores information about the loyalty.") + __properties: ClassVar[List[str]] = ["name", "earning_rules", "rewards", "points", "id", "campaign_id", "metadata", "created_at", "updated_at", "config", "expiration", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['loyalty_tier']): + raise ValueError("must be one of enum values ('loyalty_tier')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBody 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 points + if self.points: + _dict['points'] = self.points.to_dict() + # override the default output from pydantic by calling `to_dict()` of config + if self.config: + _dict['config'] = self.config.to_dict() + # override the default output from pydantic by calling `to_dict()` of expiration + if self.expiration: + _dict['expiration'] = self.expiration.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if earning_rules (nullable) is None + # and model_fields_set contains the field + if self.earning_rules is None and "earning_rules" in self.model_fields_set: + _dict['earning_rules'] = None + + # set to None if rewards (nullable) is None + # and model_fields_set contains the field + if self.rewards is None and "rewards" in self.model_fields_set: + _dict['rewards'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if config (nullable) is None + # and model_fields_set contains the field + if self.config is None and "config" in self.model_fields_set: + _dict['config'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBody 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"), + "earning_rules": obj.get("earning_rules"), + "rewards": obj.get("rewards"), + "points": LoyaltiesTiersGetResponseBodyPoints.from_dict(obj["points"]) if obj.get("points") is not None else None, + "id": obj.get("id"), + "campaign_id": obj.get("campaign_id"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "config": LoyaltiesTiersGetResponseBodyConfig.from_dict(obj["config"]) if obj.get("config") is not None else None, + "expiration": LoyaltyTierExpiration.from_dict(obj["expiration"]) if obj.get("expiration") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'loyalty_tier' + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_get_response_body_config.py b/voucherify/models/loyalties_tiers_get_response_body_config.py new file mode 100644 index 00000000..a7bc05c6 --- /dev/null +++ b/voucherify/models/loyalties_tiers_get_response_body_config.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_tiers_get_response_body_config_points import LoyaltiesTiersGetResponseBodyConfigPoints +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersGetResponseBodyConfig(BaseModel): + """ + Defines loyalty tier range in points. + """ # noqa: E501 + points: Optional[LoyaltiesTiersGetResponseBodyConfigPoints] = None + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBodyConfig 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 points + if self.points: + _dict['points'] = self.points.to_dict() + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBodyConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": LoyaltiesTiersGetResponseBodyConfigPoints.from_dict(obj["points"]) if obj.get("points") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_get_response_body_config_points.py b/voucherify/models/loyalties_tiers_get_response_body_config_points.py new file mode 100644 index 00000000..f508c248 --- /dev/null +++ b/voucherify/models/loyalties_tiers_get_response_body_config_points.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersGetResponseBodyConfigPoints(BaseModel): + """ + Defines range of loyalty tier in points. + """ # noqa: E501 + var_from: Optional[StrictInt] = Field(default=None, description="Bottom points threshold value.", alias="from") + to: Optional[StrictInt] = Field(default=None, description="Top points threshold value.") + __properties: ClassVar[List[str]] = ["from", "to"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBodyConfigPoints 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, + ) + # set to None if var_from (nullable) is None + # and model_fields_set contains the field + if self.var_from is None and "var_from" in self.model_fields_set: + _dict['from'] = None + + # set to None if to (nullable) is None + # and model_fields_set contains the field + if self.to is None and "to" in self.model_fields_set: + _dict['to'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBodyConfigPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "from": obj.get("from"), + "to": obj.get("to") + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_get_response_body_points.py b/voucherify/models/loyalties_tiers_get_response_body_points.py new file mode 100644 index 00000000..597c1ed7 --- /dev/null +++ b/voucherify/models/loyalties_tiers_get_response_body_points.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersGetResponseBodyPoints(BaseModel): + """ + Defines range of loyalty tier in points. + """ # noqa: E501 + var_from: Optional[StrictInt] = Field(default=None, description="Bottom points threshold value.", alias="from") + to: Optional[StrictInt] = Field(default=None, description="Top points threshold value.") + __properties: ClassVar[List[str]] = ["from", "to"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBodyPoints 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, + ) + # set to None if var_from (nullable) is None + # and model_fields_set contains the field + if self.var_from is None and "var_from" in self.model_fields_set: + _dict['from'] = None + + # set to None if to (nullable) is None + # and model_fields_set contains the field + if self.to is None and "to" in self.model_fields_set: + _dict['to'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersGetResponseBodyPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "from": obj.get("from"), + "to": obj.get("to") + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_list_response_body.py b/voucherify/models/loyalties_tiers_list_response_body.py new file mode 100644 index 00000000..7e8d5731 --- /dev/null +++ b/voucherify/models/loyalties_tiers_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalty_tier import LoyaltyTier +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/tiers`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about loyalty tiers in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of loyalty tier objects.") + data: Optional[List[LoyaltyTier]] = Field(default=None, description="This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer's tiers.") + total: Optional[StrictInt] = Field(default=None, description="Total number of loyalty tier objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [LoyaltyTier.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_tiers_rewards_list_response_body.py b/voucherify/models/loyalties_tiers_rewards_list_response_body.py new file mode 100644 index 00000000..c775e9fd --- /dev/null +++ b/voucherify/models/loyalties_tiers_rewards_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_loyalty_tier_reward import LoyaltiesLoyaltyTierReward +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTiersRewardsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about loyalty tier rewards in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of loyalty tier reward objects.") + data: Optional[List[LoyaltiesLoyaltyTierReward]] = Field(default=None, description="Contains array of loyalty tier reward objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of loyalty tier reward objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTiersRewardsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTiersRewardsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [LoyaltiesLoyaltyTierReward.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/loyalties_transfer_points.py b/voucherify/models/loyalties_transfer_points.py new file mode 100644 index 00000000..a63d8b35 --- /dev/null +++ b/voucherify/models/loyalties_transfer_points.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesTransferPoints(BaseModel): + """ + LoyaltiesTransferPoints + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Unique loyalty card code from which the user wants to transfer loyalty points (source).") + points: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source).") + reason: Optional[StrictStr] = Field(default=None, description="Reason for the transfer.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service.") + __properties: ClassVar[List[str]] = ["code", "points", "reason", "source_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesTransferPoints 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, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesTransferPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "points": obj.get("points"), + "reason": obj.get("reason"), + "source_id": obj.get("source_id") + }) + return _obj + + diff --git a/voucherify/models/loyalties_update_campaign_request_body.py b/voucherify/models/loyalties_update_campaign_request_body.py new file mode 100644 index 00000000..bcb2561c --- /dev/null +++ b/voucherify/models/loyalties_update_campaign_request_body.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalties_update_campaign_request_body_options import LoyaltiesUpdateCampaignRequestBodyOptions +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesUpdateCampaignRequestBody(BaseModel): + """ + Request body schema for **PUT** `/loyalties/{campaignId}`. + """ # noqa: E501 + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + category: Optional[StrictStr] = Field(default=None, description="The category assigned to the campaign. Either pass this parameter OR the `category_id`.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + unset_metadata_fields: Optional[List[StrictStr]] = Field(default=None, description="Determine which metadata should be removed from campaign.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.") + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the vouchers will be active after publishing. The value is shown in the ISO 8601 format. For example, a voucher with the value of P24D will be valid for a duration of 24 days.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). - `STATIC`: vouchers need to be manually published.") + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + options: Optional[LoyaltiesUpdateCampaignRequestBodyOptions] = None + __properties: ClassVar[List[str]] = ["start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "description", "category", "metadata", "unset_metadata_fields", "category_id", "activity_duration_after_publishing", "join_once", "auto_join", "type", "loyalty_tiers_expiration", "options"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesUpdateCampaignRequestBody 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of options + if self.options: + _dict['options'] = self.options.to_dict() + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if unset_metadata_fields (nullable) is None + # and model_fields_set contains the field + if self.unset_metadata_fields is None and "unset_metadata_fields" in self.model_fields_set: + _dict['unset_metadata_fields'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if options (nullable) is None + # and model_fields_set contains the field + if self.options is None and "options" in self.model_fields_set: + _dict['options'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesUpdateCampaignRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "description": obj.get("description"), + "category": obj.get("category"), + "metadata": obj.get("metadata"), + "unset_metadata_fields": obj.get("unset_metadata_fields"), + "category_id": obj.get("category_id"), + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "join_once": obj.get("join_once"), + "auto_join": obj.get("auto_join"), + "type": obj.get("type"), + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "options": LoyaltiesUpdateCampaignRequestBodyOptions.from_dict(obj["options"]) if obj.get("options") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalties_update_campaign_request_body_options.py b/voucherify/models/loyalties_update_campaign_request_body_options.py new file mode 100644 index 00000000..81e8c17d --- /dev/null +++ b/voucherify/models/loyalties_update_campaign_request_body_options.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesUpdateCampaignRequestBodyOptions(BaseModel): + """ + LoyaltiesUpdateCampaignRequestBodyOptions + """ # noqa: E501 + recalculate_tiers: Optional[StrictBool] = Field(default=None, description="Determine if tiers should be recalculated or no.") + __properties: ClassVar[List[str]] = ["recalculate_tiers"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesUpdateCampaignRequestBodyOptions 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, + ) + # set to None if recalculate_tiers (nullable) is None + # and model_fields_set contains the field + if self.recalculate_tiers is None and "recalculate_tiers" in self.model_fields_set: + _dict['recalculate_tiers'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesUpdateCampaignRequestBodyOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "recalculate_tiers": obj.get("recalculate_tiers") + }) + return _obj + + diff --git a/voucherify/models/loyalties_update_campaign_response_body.py b/voucherify/models/loyalties_update_campaign_response_body.py new file mode 100644 index 00000000..87663f9e --- /dev/null +++ b/voucherify/models/loyalties_update_campaign_response_body.py @@ -0,0 +1,345 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.category import Category +from voucherify.models.loyalty_campaign_voucher import LoyaltyCampaignVoucher +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltiesUpdateCampaignResponseBody(BaseModel): + """ + Response body schema for **PUT** `/loyalties/{campaignId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default='LOYALTY_PROGRAM', description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[LoyaltyCampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + access_settings_assignments: Optional[AccessSettingsCampaignAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "loyalty_tiers_expiration", "validation_rules_assignments", "access_settings_assignments"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltiesUpdateCampaignResponseBody 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of access_settings_assignments + if self.access_settings_assignments: + _dict['access_settings_assignments'] = self.access_settings_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltiesUpdateCampaignResponseBody 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type") if obj.get("campaign_type") is not None else 'LOYALTY_PROGRAM', + "type": obj.get("type"), + "voucher": LoyaltyCampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "access_settings_assignments": AccessSettingsCampaignAssignmentsList.from_dict(obj["access_settings_assignments"]) if obj.get("access_settings_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_campaign.py b/voucherify/models/loyalty_campaign.py new file mode 100644 index 00000000..a3474a76 --- /dev/null +++ b/voucherify/models/loyalty_campaign.py @@ -0,0 +1,345 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.access_settings_campaign_assignments_list import AccessSettingsCampaignAssignmentsList +from voucherify.models.category import Category +from voucherify.models.loyalty_campaign_voucher import LoyaltyCampaignVoucher +from voucherify.models.loyalty_tiers_expiration_all import LoyaltyTiersExpirationAll +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCampaign(BaseModel): + """ + LoyaltyCampaign + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Campaign name.") + description: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the campaign such as a campaign description and details.") + campaign_type: Optional[StrictStr] = Field(default='LOYALTY_PROGRAM', description="Type of campaign.") + type: Optional[StrictStr] = Field(default=None, description="Defines whether the campaign can be updated with new vouchers after campaign creation. - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria - `STATIC`: vouchers need to be manually published") + voucher: Optional[LoyaltyCampaignVoucher] = None + auto_join: Optional[StrictBool] = Field(default=None, description="Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.") + join_once: Optional[StrictBool] = Field(default=None, description="If this value is set to `true`, customers will be able to join the campaign only once.") + use_voucher_metadata_schema: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + activity_duration_after_publishing: Optional[StrictStr] = Field(default=None, description="Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days.") + vouchers_count: Optional[StrictInt] = Field(default=None, description="Total number of unique vouchers in campaign.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the campaign was last updated in ISO 8601 format.") + category: Optional[StrictStr] = Field(default=None, description="Unique category name.") + creation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign creation.") + vouchers_generation_status: Optional[StrictStr] = Field(default=None, description="Indicates the status of the campaign's voucher generation.") + protected: Optional[StrictBool] = Field(default=None, description="Indicates whether the resource can be deleted.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by JSON. This object stores information about the campaign.") + loyalty_tiers_expiration: Optional[LoyaltyTiersExpirationAll] = None + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + access_settings_assignments: Optional[AccessSettingsCampaignAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "name", "description", "campaign_type", "type", "voucher", "auto_join", "join_once", "use_voucher_metadata_schema", "validity_timeframe", "validity_day_of_week", "validity_hours", "activity_duration_after_publishing", "vouchers_count", "start_date", "expiration_date", "active", "metadata", "created_at", "updated_at", "category", "creation_status", "vouchers_generation_status", "protected", "category_id", "categories", "object", "loyalty_tiers_expiration", "validation_rules_assignments", "access_settings_assignments"] + + @field_validator('campaign_type') + def campaign_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AUTO_UPDATE', 'STATIC']): + raise ValueError("must be one of enum values ('AUTO_UPDATE', 'STATIC')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('creation_status') + def creation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + @field_validator('vouchers_generation_status') + def vouchers_generation_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING']): + raise ValueError("must be one of enum values ('DONE', 'IN_PROGRESS', 'FAILED', 'DRAFT', 'MODIFYING')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCampaign 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 voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of loyalty_tiers_expiration + if self.loyalty_tiers_expiration: + _dict['loyalty_tiers_expiration'] = self.loyalty_tiers_expiration.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of access_settings_assignments + if self.access_settings_assignments: + _dict['access_settings_assignments'] = self.access_settings_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if auto_join (nullable) is None + # and model_fields_set contains the field + if self.auto_join is None and "auto_join" in self.model_fields_set: + _dict['auto_join'] = None + + # set to None if join_once (nullable) is None + # and model_fields_set contains the field + if self.join_once is None and "join_once" in self.model_fields_set: + _dict['join_once'] = None + + # set to None if use_voucher_metadata_schema (nullable) is None + # and model_fields_set contains the field + if self.use_voucher_metadata_schema is None and "use_voucher_metadata_schema" in self.model_fields_set: + _dict['use_voucher_metadata_schema'] = None + + # set to None if activity_duration_after_publishing (nullable) is None + # and model_fields_set contains the field + if self.activity_duration_after_publishing is None and "activity_duration_after_publishing" in self.model_fields_set: + _dict['activity_duration_after_publishing'] = None + + # set to None if vouchers_count (nullable) is None + # and model_fields_set contains the field + if self.vouchers_count is None and "vouchers_count" in self.model_fields_set: + _dict['vouchers_count'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if creation_status (nullable) is None + # and model_fields_set contains the field + if self.creation_status is None and "creation_status" in self.model_fields_set: + _dict['creation_status'] = None + + # set to None if vouchers_generation_status (nullable) is None + # and model_fields_set contains the field + if self.vouchers_generation_status is None and "vouchers_generation_status" in self.model_fields_set: + _dict['vouchers_generation_status'] = None + + # set to None if protected (nullable) is None + # and model_fields_set contains the field + if self.protected is None and "protected" in self.model_fields_set: + _dict['protected'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCampaign 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"), + "name": obj.get("name"), + "description": obj.get("description"), + "campaign_type": obj.get("campaign_type") if obj.get("campaign_type") is not None else 'LOYALTY_PROGRAM', + "type": obj.get("type"), + "voucher": LoyaltyCampaignVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "auto_join": obj.get("auto_join"), + "join_once": obj.get("join_once"), + "use_voucher_metadata_schema": obj.get("use_voucher_metadata_schema"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "activity_duration_after_publishing": obj.get("activity_duration_after_publishing"), + "vouchers_count": obj.get("vouchers_count"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "category": obj.get("category"), + "creation_status": obj.get("creation_status"), + "vouchers_generation_status": obj.get("vouchers_generation_status"), + "protected": obj.get("protected"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'campaign', + "loyalty_tiers_expiration": LoyaltyTiersExpirationAll.from_dict(obj["loyalty_tiers_expiration"]) if obj.get("loyalty_tiers_expiration") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "access_settings_assignments": AccessSettingsCampaignAssignmentsList.from_dict(obj["access_settings_assignments"]) if obj.get("access_settings_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_campaign_voucher.py b/voucherify/models/loyalty_campaign_voucher.py new file mode 100644 index 00000000..e58a3c6f --- /dev/null +++ b/voucherify/models/loyalty_campaign_voucher.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.campaign_loyalty_card import CampaignLoyaltyCard +from voucherify.models.code_config import CodeConfig +from voucherify.models.loyalty_campaign_voucher_redemption import LoyaltyCampaignVoucherRedemption +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCampaignVoucher(BaseModel): + """ + Schema model for a campaign voucher. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default='LOYALTY_CARD', description="Type of voucher.") + loyalty_card: Optional[CampaignLoyaltyCard] = None + redemption: Optional[LoyaltyCampaignVoucherRedemption] = None + code_config: CodeConfig + is_referral_code: Optional[StrictBool] = Field(default=None, description="Always `false` for a loyalty card voucher") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + __properties: ClassVar[List[str]] = ["type", "loyalty_card", "redemption", "code_config", "is_referral_code", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD']): + raise ValueError("must be one of enum values ('LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCampaignVoucher 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 loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of code_config + if self.code_config: + _dict['code_config'] = self.code_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCampaignVoucher from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") if obj.get("type") is not None else 'LOYALTY_CARD', + "loyalty_card": CampaignLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "redemption": LoyaltyCampaignVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "code_config": CodeConfig.from_dict(obj["code_config"]) if obj.get("code_config") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_campaign_voucher_redemption.py b/voucherify/models/loyalty_campaign_voucher_redemption.py new file mode 100644 index 00000000..ec15b1a0 --- /dev/null +++ b/voucherify/models/loyalty_campaign_voucher_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCampaignVoucherRedemption(BaseModel): + """ + Defines the redemption limits on vouchers. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCampaignVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCampaignVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction.py b/voucherify/models/loyalty_card_transaction.py new file mode 100644 index 00000000..708a1862 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_card_transaction_details import LoyaltyCardTransactionDetails +from voucherify.models.loyalty_card_transactions_type import LoyaltyCardTransactionsType +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransaction(BaseModel): + """ + LoyaltyCardTransaction + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique transaction ID.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null.") + voucher_id: Optional[StrictStr] = Field(default=None, description="Unique voucher ID.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.") + source: Optional[StrictStr] = Field(default=None, description="The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null.") + reason: Optional[StrictStr] = Field(default=None, description="Reason why the transaction occurred. In case of a redemption, this value is null.") + type: LoyaltyCardTransactionsType + details: Optional[LoyaltyCardTransactionDetails] = None + related_transaction_id: Optional[StrictStr] = Field(default=None, description="The related transaction ID on the receiving card.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format.") + __properties: ClassVar[List[str]] = ["id", "source_id", "voucher_id", "campaign_id", "source", "reason", "type", "details", "related_transaction_id", "created_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransaction 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() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if voucher_id (nullable) is None + # and model_fields_set contains the field + if self.voucher_id is None and "voucher_id" in self.model_fields_set: + _dict['voucher_id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if details (nullable) is None + # and model_fields_set contains the field + if self.details is None and "details" in self.model_fields_set: + _dict['details'] = None + + # set to None if related_transaction_id (nullable) is None + # and model_fields_set contains the field + if self.related_transaction_id is None and "related_transaction_id" in self.model_fields_set: + _dict['related_transaction_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransaction 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"), + "source_id": obj.get("source_id"), + "voucher_id": obj.get("voucher_id"), + "campaign_id": obj.get("campaign_id"), + "source": obj.get("source"), + "reason": obj.get("reason"), + "type": obj.get("type"), + "details": LoyaltyCardTransactionDetails.from_dict(obj["details"]) if obj.get("details") is not None else None, + "related_transaction_id": obj.get("related_transaction_id"), + "created_at": obj.get("created_at") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details.py b/voucherify/models/loyalty_card_transaction_details.py new file mode 100644 index 00000000..8fbd1d4c --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details.py @@ -0,0 +1,218 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_card_transaction_details_balance import LoyaltyCardTransactionDetailsBalance +from voucherify.models.loyalty_card_transaction_details_custom_event import LoyaltyCardTransactionDetailsCustomEvent +from voucherify.models.loyalty_card_transaction_details_earning_rule import LoyaltyCardTransactionDetailsEarningRule +from voucherify.models.loyalty_card_transaction_details_event import LoyaltyCardTransactionDetailsEvent +from voucherify.models.loyalty_card_transaction_details_event_schema import LoyaltyCardTransactionDetailsEventSchema +from voucherify.models.loyalty_card_transaction_details_loyalty_tier import LoyaltyCardTransactionDetailsLoyaltyTier +from voucherify.models.loyalty_card_transaction_details_order import LoyaltyCardTransactionDetailsOrder +from voucherify.models.loyalty_card_transaction_details_redemption import LoyaltyCardTransactionDetailsRedemption +from voucherify.models.loyalty_card_transaction_details_reward import LoyaltyCardTransactionDetailsReward +from voucherify.models.loyalty_card_transaction_details_rollback import LoyaltyCardTransactionDetailsRollback +from voucherify.models.loyalty_card_transaction_details_segment import LoyaltyCardTransactionDetailsSegment +from voucherify.models.simple_voucher import SimpleVoucher +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetails(BaseModel): + """ + Contains the detailed information about the transaction. + """ # noqa: E501 + balance: Optional[LoyaltyCardTransactionDetailsBalance] = None + order: Optional[LoyaltyCardTransactionDetailsOrder] = None + event: Optional[LoyaltyCardTransactionDetailsEvent] = None + earning_rule: Optional[LoyaltyCardTransactionDetailsEarningRule] = None + segment: Optional[LoyaltyCardTransactionDetailsSegment] = None + loyalty_tier: Optional[LoyaltyCardTransactionDetailsLoyaltyTier] = None + redemption: Optional[LoyaltyCardTransactionDetailsRedemption] = None + rollback: Optional[LoyaltyCardTransactionDetailsRollback] = None + custom_event: Optional[LoyaltyCardTransactionDetailsCustomEvent] = None + event_schema: Optional[LoyaltyCardTransactionDetailsEventSchema] = None + reward: Optional[LoyaltyCardTransactionDetailsReward] = None + source_voucher: Optional[SimpleVoucher] = None + destination_voucher: Optional[SimpleVoucher] = None + __properties: ClassVar[List[str]] = ["balance", "order", "event", "earning_rule", "segment", "loyalty_tier", "redemption", "rollback", "custom_event", "event_schema", "reward", "source_voucher", "destination_voucher"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetails 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 balance + if self.balance: + _dict['balance'] = self.balance.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of event + if self.event: + _dict['event'] = self.event.to_dict() + # override the default output from pydantic by calling `to_dict()` of earning_rule + if self.earning_rule: + _dict['earning_rule'] = self.earning_rule.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of rollback + if self.rollback: + _dict['rollback'] = self.rollback.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of event_schema + if self.event_schema: + _dict['event_schema'] = self.event_schema.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_voucher + if self.source_voucher: + _dict['source_voucher'] = self.source_voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of destination_voucher + if self.destination_voucher: + _dict['destination_voucher'] = self.destination_voucher.to_dict() + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if event (nullable) is None + # and model_fields_set contains the field + if self.event is None and "event" in self.model_fields_set: + _dict['event'] = None + + # set to None if earning_rule (nullable) is None + # and model_fields_set contains the field + if self.earning_rule is None and "earning_rule" in self.model_fields_set: + _dict['earning_rule'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if rollback (nullable) is None + # and model_fields_set contains the field + if self.rollback is None and "rollback" in self.model_fields_set: + _dict['rollback'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if event_schema (nullable) is None + # and model_fields_set contains the field + if self.event_schema is None and "event_schema" in self.model_fields_set: + _dict['event_schema'] = None + + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "balance": LoyaltyCardTransactionDetailsBalance.from_dict(obj["balance"]) if obj.get("balance") is not None else None, + "order": LoyaltyCardTransactionDetailsOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "event": LoyaltyCardTransactionDetailsEvent.from_dict(obj["event"]) if obj.get("event") is not None else None, + "earning_rule": LoyaltyCardTransactionDetailsEarningRule.from_dict(obj["earning_rule"]) if obj.get("earning_rule") is not None else None, + "segment": LoyaltyCardTransactionDetailsSegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": LoyaltyCardTransactionDetailsLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "redemption": LoyaltyCardTransactionDetailsRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "rollback": LoyaltyCardTransactionDetailsRollback.from_dict(obj["rollback"]) if obj.get("rollback") is not None else None, + "custom_event": LoyaltyCardTransactionDetailsCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "event_schema": LoyaltyCardTransactionDetailsEventSchema.from_dict(obj["event_schema"]) if obj.get("event_schema") is not None else None, + "reward": LoyaltyCardTransactionDetailsReward.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "source_voucher": SimpleVoucher.from_dict(obj["source_voucher"]) if obj.get("source_voucher") is not None else None, + "destination_voucher": SimpleVoucher.from_dict(obj["destination_voucher"]) if obj.get("destination_voucher") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_balance.py b/voucherify/models/loyalty_card_transaction_details_balance.py new file mode 100644 index 00000000..b9d72171 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_balance.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.loyalty_card_transaction_details_balance_related_object import LoyaltyCardTransactionDetailsBalanceRelatedObject +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsBalance(BaseModel): + """ + Contains information on how the balance was affected by the transaction. + """ # noqa: E501 + type: Optional[Annotated[str, Field(strict=True)]] = Field(default='loyalty_card', description="The type of voucher whose balance is being adjusted due to the transaction.") + total: Optional[StrictInt] = Field(default=None, description="The number of all points accumulated on the card as affected by add or subtract operations.") + object: Optional[Annotated[str, Field(strict=True)]] = Field(default='balance', description="The type of the object represented by the JSON.") + points: Optional[StrictInt] = Field(default=None, description="Points added or subtracted in the transaction.") + balance: Optional[StrictInt] = Field(default=None, description="The available points on the card after the transaction as affected by redemption or rollback.") + related_object: Optional[LoyaltyCardTransactionDetailsBalanceRelatedObject] = None + __properties: ClassVar[List[str]] = ["type", "total", "object", "points", "balance", "related_object"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"loyalty_card", value): + raise ValueError(r"must validate the regular expression /loyalty_card/") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['loyalty_card']): + raise ValueError("must be one of enum values ('loyalty_card')") + return value + + @field_validator('object') + def object_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"balance", value): + raise ValueError(r"must validate the regular expression /balance/") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['balance']): + raise ValueError("must be one of enum values ('balance')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsBalance 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 related_object + if self.related_object: + _dict['related_object'] = self.related_object.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if related_object (nullable) is None + # and model_fields_set contains the field + if self.related_object is None and "related_object" in self.model_fields_set: + _dict['related_object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsBalance from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") if obj.get("type") is not None else 'loyalty_card', + "total": obj.get("total"), + "object": obj.get("object") if obj.get("object") is not None else 'balance', + "points": obj.get("points"), + "balance": obj.get("balance"), + "related_object": LoyaltyCardTransactionDetailsBalanceRelatedObject.from_dict(obj["related_object"]) if obj.get("related_object") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_balance_related_object.py b/voucherify/models/loyalty_card_transaction_details_balance_related_object.py new file mode 100644 index 00000000..e5e2d44e --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_balance_related_object.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsBalanceRelatedObject(BaseModel): + """ + Defines the resource that is being modified with the values that are returned in the balance object. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.") + type: Optional[Annotated[str, Field(strict=True)]] = Field(default='voucher', description="The object being modified, i.e. voucher.") + __properties: ClassVar[List[str]] = ["id", "type"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"voucher", value): + raise ValueError(r"must validate the regular expression /voucher/") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsBalanceRelatedObject 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsBalanceRelatedObject 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"), + "type": obj.get("type") if obj.get("type") is not None else 'voucher' + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_custom_event.py b/voucherify/models/loyalty_card_transaction_details_custom_event.py new file mode 100644 index 00000000..d3ef72e9 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_custom_event.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsCustomEvent(BaseModel): + """ + Contains information about the custom event that triggers the point accrual. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique event ID.") + type: Optional[StrictStr] = Field(default=None, description="Type of custom event.") + __properties: ClassVar[List[str]] = ["id", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsCustomEvent 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsCustomEvent 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"), + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_earning_rule.py b/voucherify/models/loyalty_card_transaction_details_earning_rule.py new file mode 100644 index 00000000..275b33ca --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_earning_rule.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_card_transaction_details_earning_rule_source import LoyaltyCardTransactionDetailsEarningRuleSource +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsEarningRule(BaseModel): + """ + Contains information about the earning rule. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique earning rule ID.") + source: Optional[LoyaltyCardTransactionDetailsEarningRuleSource] = None + __properties: ClassVar[List[str]] = ["id", "source"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEarningRule 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 source + if self.source: + _dict['source'] = self.source.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEarningRule 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"), + "source": LoyaltyCardTransactionDetailsEarningRuleSource.from_dict(obj["source"]) if obj.get("source") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_earning_rule_source.py b/voucherify/models/loyalty_card_transaction_details_earning_rule_source.py new file mode 100644 index 00000000..c82e957b --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_earning_rule_source.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsEarningRuleSource(BaseModel): + """ + Contains the custom earning rule name. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + __properties: ClassVar[List[str]] = ["banner"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEarningRuleSource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEarningRuleSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_event.py b/voucherify/models/loyalty_card_transaction_details_event.py new file mode 100644 index 00000000..35704523 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_event.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsEvent(BaseModel): + """ + Contains information about the event that triggers the point accrual. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique event ID.") + type: Optional[StrictStr] = Field(default=None, description="Type of event.") + __properties: ClassVar[List[str]] = ["id", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEvent 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEvent 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"), + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_event_schema.py b/voucherify/models/loyalty_card_transaction_details_event_schema.py new file mode 100644 index 00000000..9b216bea --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_event_schema.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsEventSchema(BaseModel): + """ + Contains information about the custom event metadata schema. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique metadata schema ID.") + name: Optional[StrictStr] = Field(default=None, description="Type of custom event.") + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEventSchema 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsEventSchema 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_loyalty_tier.py b/voucherify/models/loyalty_card_transaction_details_loyalty_tier.py new file mode 100644 index 00000000..9dbbf314 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_loyalty_tier.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsLoyaltyTier(BaseModel): + """ + Contains information about the loyalty tier. + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsLoyaltyTier 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_order.py b/voucherify/models/loyalty_card_transaction_details_order.py new file mode 100644 index 00000000..965c5df0 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_order.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsOrder(BaseModel): + """ + Contains information about the original order. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique order ID.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service.") + __properties: ClassVar[List[str]] = ["id", "source_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsOrder 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsOrder 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"), + "source_id": obj.get("source_id") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_redemption.py b/voucherify/models/loyalty_card_transaction_details_redemption.py new file mode 100644 index 00000000..c1975911 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsRedemption(BaseModel): + """ + Contains information about the original redemption. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsRedemption 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsRedemption 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") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_reward.py b/voucherify/models/loyalty_card_transaction_details_reward.py new file mode 100644 index 00000000..181da04c --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_reward.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsReward(BaseModel): + """ + Contains information about the pay with points reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID.") + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsReward 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsReward 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_rollback.py b/voucherify/models/loyalty_card_transaction_details_rollback.py new file mode 100644 index 00000000..f5e8ddb8 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_rollback.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsRollback(BaseModel): + """ + Contains information about the redemption rollback. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption rollback ID.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsRollback 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsRollback 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") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transaction_details_segment.py b/voucherify/models/loyalty_card_transaction_details_segment.py new file mode 100644 index 00000000..410789f9 --- /dev/null +++ b/voucherify/models/loyalty_card_transaction_details_segment.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyCardTransactionDetailsSegment(BaseModel): + """ + Contains information about the segment. + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsSegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyCardTransactionDetailsSegment 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/loyalty_card_transactions_type.py b/voucherify/models/loyalty_card_transactions_type.py new file mode 100644 index 00000000..40a8acb1 --- /dev/null +++ b/voucherify/models/loyalty_card_transactions_type.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class LoyaltyCardTransactionsType(str, Enum): + """ + LoyaltyCardTransactionsType + """ + + """ + allowed enum values + """ + POINTS_ACCRUAL = 'POINTS_ACCRUAL' + POINTS_REDEMPTION = 'POINTS_REDEMPTION' + POINTS_REFUND = 'POINTS_REFUND' + POINTS_ADDITION = 'POINTS_ADDITION' + POINTS_REMOVAL = 'POINTS_REMOVAL' + POINTS_EXPIRATION = 'POINTS_EXPIRATION' + POINTS_TRANSFER_IN = 'POINTS_TRANSFER_IN' + POINTS_TRANSFER_OUT = 'POINTS_TRANSFER_OUT' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LoyaltyCardTransactionsType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/loyalty_member.py b/voucherify/models/loyalty_member.py new file mode 100644 index 00000000..a74eb2d9 --- /dev/null +++ b/voucherify/models/loyalty_member.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_member_loyalty_card import LoyaltyMemberLoyaltyCard +from voucherify.models.loyalty_member_publish import LoyaltyMemberPublish +from voucherify.models.loyalty_member_redemption import LoyaltyMemberRedemption +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyMember(BaseModel): + """ + This is an object representing a loyalty member. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default='LOYALTY_CARD', description="Defines the type of the voucher. ") + discount: Optional[Dict[str, Any]] = None + gift: Optional[Dict[str, Any]] = None + loyalty_card: Optional[LoyaltyMemberLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="This is always false for loyalty members.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the customer who owns the voucher.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[LoyaltyMemberPublish] = None + redemption: Optional[LoyaltyMemberRedemption] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "object", "publish", "redemption"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD']): + raise ValueError("must be one of enum values ('LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyMember 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 loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if discount (nullable) is None + # and model_fields_set contains the field + if self.discount is None and "discount" in self.model_fields_set: + _dict['discount'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyMember 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type") if obj.get("type") is not None else 'LOYALTY_CARD', + "discount": obj.get("discount"), + "gift": obj.get("gift"), + "loyalty_card": LoyaltyMemberLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": LoyaltyMemberPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": LoyaltyMemberRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_member_loyalty_card.py b/voucherify/models/loyalty_member_loyalty_card.py new file mode 100644 index 00000000..0df2ca28 --- /dev/null +++ b/voucherify/models/loyalty_member_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyMemberLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyMemberLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyMemberLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/loyalty_member_publish.py b/voucherify/models/loyalty_member_publish.py new file mode 100644 index 00000000..0390afd6 --- /dev/null +++ b/voucherify/models/loyalty_member_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyMemberPublish(BaseModel): + """ + This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication event counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyMemberPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyMemberPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalty_member_redemption.py b/voucherify/models/loyalty_member_redemption.py new file mode 100644 index 00000000..80bf4533 --- /dev/null +++ b/voucherify/models/loyalty_member_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyMemberRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyMemberRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyMemberRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/loyalty_tier.py b/voucherify/models/loyalty_tier.py new file mode 100644 index 00000000..d9c9575f --- /dev/null +++ b/voucherify/models/loyalty_tier.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_tier_config import LoyaltyTierConfig +from voucherify.models.loyalty_tier_expiration import LoyaltyTierExpiration +from voucherify.models.loyalty_tier_points import LoyaltyTierPoints +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTier(BaseModel): + """ + LoyaltyTier + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Loyalty Tier name.") + earning_rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of earning rule IDs and their points mapping for the given earning rule.") + rewards: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of reward IDs and their points mapping for the given reward.") + points: Optional[LoyaltyTierPoints] = None + id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Unique parent campaign ID.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format.") + config: Optional[LoyaltyTierConfig] = None + expiration: Optional[LoyaltyTierExpiration] = None + object: Optional[StrictStr] = Field(default='loyalty_tier', description="The type of the object represented by JSON. This object stores information about the loyalty.") + __properties: ClassVar[List[str]] = ["name", "earning_rules", "rewards", "points", "id", "campaign_id", "metadata", "created_at", "updated_at", "config", "expiration", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['loyalty_tier']): + raise ValueError("must be one of enum values ('loyalty_tier')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTier 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 points + if self.points: + _dict['points'] = self.points.to_dict() + # override the default output from pydantic by calling `to_dict()` of config + if self.config: + _dict['config'] = self.config.to_dict() + # override the default output from pydantic by calling `to_dict()` of expiration + if self.expiration: + _dict['expiration'] = self.expiration.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if earning_rules (nullable) is None + # and model_fields_set contains the field + if self.earning_rules is None and "earning_rules" in self.model_fields_set: + _dict['earning_rules'] = None + + # set to None if rewards (nullable) is None + # and model_fields_set contains the field + if self.rewards is None and "rewards" in self.model_fields_set: + _dict['rewards'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if config (nullable) is None + # and model_fields_set contains the field + if self.config is None and "config" in self.model_fields_set: + _dict['config'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTier 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"), + "earning_rules": obj.get("earning_rules"), + "rewards": obj.get("rewards"), + "points": LoyaltyTierPoints.from_dict(obj["points"]) if obj.get("points") is not None else None, + "id": obj.get("id"), + "campaign_id": obj.get("campaign_id"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "config": LoyaltyTierConfig.from_dict(obj["config"]) if obj.get("config") is not None else None, + "expiration": LoyaltyTierExpiration.from_dict(obj["expiration"]) if obj.get("expiration") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'loyalty_tier' + }) + return _obj + + diff --git a/voucherify/models/loyalty_tier_base.py b/voucherify/models/loyalty_tier_base.py new file mode 100644 index 00000000..c46bcb9e --- /dev/null +++ b/voucherify/models/loyalty_tier_base.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_tier_base_points import LoyaltyTierBasePoints +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTierBase(BaseModel): + """ + LoyaltyTierBase + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Loyalty Tier name.") + earning_rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of earning rule IDs and their points mapping for the given earning rule.") + rewards: Optional[Dict[str, Any]] = Field(default=None, description="Contains a list of reward IDs and their points mapping for the given reward.") + points: Optional[LoyaltyTierBasePoints] = None + __properties: ClassVar[List[str]] = ["name", "earning_rules", "rewards", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTierBase 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 points + if self.points: + _dict['points'] = self.points.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if earning_rules (nullable) is None + # and model_fields_set contains the field + if self.earning_rules is None and "earning_rules" in self.model_fields_set: + _dict['earning_rules'] = None + + # set to None if rewards (nullable) is None + # and model_fields_set contains the field + if self.rewards is None and "rewards" in self.model_fields_set: + _dict['rewards'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTierBase 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"), + "earning_rules": obj.get("earning_rules"), + "rewards": obj.get("rewards"), + "points": LoyaltyTierBasePoints.from_dict(obj["points"]) if obj.get("points") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_tier_base_points.py b/voucherify/models/loyalty_tier_base_points.py new file mode 100644 index 00000000..eb3110dc --- /dev/null +++ b/voucherify/models/loyalty_tier_base_points.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTierBasePoints(BaseModel): + """ + Defines range of loyalty tier in points. + """ # noqa: E501 + var_from: Optional[StrictInt] = Field(default=None, description="Bottom points threshold value.", alias="from") + to: Optional[StrictInt] = Field(default=None, description="Top points threshold value.") + __properties: ClassVar[List[str]] = ["from", "to"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTierBasePoints 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, + ) + # set to None if var_from (nullable) is None + # and model_fields_set contains the field + if self.var_from is None and "var_from" in self.model_fields_set: + _dict['from'] = None + + # set to None if to (nullable) is None + # and model_fields_set contains the field + if self.to is None and "to" in self.model_fields_set: + _dict['to'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTierBasePoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "from": obj.get("from"), + "to": obj.get("to") + }) + return _obj + + diff --git a/voucherify/models/loyalty_tier_config.py b/voucherify/models/loyalty_tier_config.py new file mode 100644 index 00000000..d3cf4a24 --- /dev/null +++ b/voucherify/models/loyalty_tier_config.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_tier_config_points import LoyaltyTierConfigPoints +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTierConfig(BaseModel): + """ + Defines loyalty tier range in points. + """ # noqa: E501 + points: Optional[LoyaltyTierConfigPoints] = None + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTierConfig 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 points + if self.points: + _dict['points'] = self.points.to_dict() + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTierConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": LoyaltyTierConfigPoints.from_dict(obj["points"]) if obj.get("points") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_tier_config_points.py b/voucherify/models/loyalty_tier_config_points.py new file mode 100644 index 00000000..1b05c51a --- /dev/null +++ b/voucherify/models/loyalty_tier_config_points.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTierConfigPoints(BaseModel): + """ + Defines range of loyalty tier in points. + """ # noqa: E501 + var_from: Optional[StrictInt] = Field(default=None, description="Bottom points threshold value.", alias="from") + to: Optional[StrictInt] = Field(default=None, description="Top points threshold value.") + __properties: ClassVar[List[str]] = ["from", "to"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTierConfigPoints 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, + ) + # set to None if var_from (nullable) is None + # and model_fields_set contains the field + if self.var_from is None and "var_from" in self.model_fields_set: + _dict['from'] = None + + # set to None if to (nullable) is None + # and model_fields_set contains the field + if self.to is None and "to" in self.model_fields_set: + _dict['to'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTierConfigPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "from": obj.get("from"), + "to": obj.get("to") + }) + return _obj + + diff --git a/voucherify/models/loyalty_tier_expiration.py b/voucherify/models/loyalty_tier_expiration.py new file mode 100644 index 00000000..9d98feaf --- /dev/null +++ b/voucherify/models/loyalty_tier_expiration.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTierExpiration(BaseModel): + """ + Defines loyalty tier expiration date. + """ # noqa: E501 + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + tier_id: Optional[StrictStr] = Field(default=None, description="Unique tier ID, assigned by Voucherify.") + start_date: Optional[StrictStr] = Field(default=None, description="Activation timestamp defines when the loyalty tier starts to be active in ISO 8601 format. Loyalty tier is inactive before this date.") + expiration_date: Optional[StrictStr] = Field(default=None, description="Expiration timestamp defines when the loyalty tier expires in ISO 8601 format. Loyalty tier is inactive after this date.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the loyalty tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the loyalty tier was updated. The value is shown in the ISO 8601 format.") + __properties: ClassVar[List[str]] = ["customer_id", "campaign_id", "tier_id", "start_date", "expiration_date", "created_at", "updated_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTierExpiration 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, + ) + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if tier_id (nullable) is None + # and model_fields_set contains the field + if self.tier_id is None and "tier_id" in self.model_fields_set: + _dict['tier_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTierExpiration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "customer_id": obj.get("customer_id"), + "campaign_id": obj.get("campaign_id"), + "tier_id": obj.get("tier_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at") + }) + return _obj + + diff --git a/voucherify/models/loyalty_tier_points.py b/voucherify/models/loyalty_tier_points.py new file mode 100644 index 00000000..3a9a23fe --- /dev/null +++ b/voucherify/models/loyalty_tier_points.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTierPoints(BaseModel): + """ + Defines range of loyalty tier in points. + """ # noqa: E501 + var_from: Optional[StrictInt] = Field(default=None, description="Bottom points threshold value.", alias="from") + to: Optional[StrictInt] = Field(default=None, description="Top points threshold value.") + __properties: ClassVar[List[str]] = ["from", "to"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTierPoints 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, + ) + # set to None if var_from (nullable) is None + # and model_fields_set contains the field + if self.var_from is None and "var_from" in self.model_fields_set: + _dict['from'] = None + + # set to None if to (nullable) is None + # and model_fields_set contains the field + if self.to is None and "to" in self.model_fields_set: + _dict['to'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTierPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "from": obj.get("from"), + "to": obj.get("to") + }) + return _obj + + diff --git a/voucherify/models/loyalty_tiers_expiration_all.py b/voucherify/models/loyalty_tiers_expiration_all.py new file mode 100644 index 00000000..299635fd --- /dev/null +++ b/voucherify/models/loyalty_tiers_expiration_all.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalty_tiers_expiration_all_expiration_date import LoyaltyTiersExpirationAllExpirationDate +from voucherify.models.loyalty_tiers_expiration_all_start_date import LoyaltyTiersExpirationAllStartDate +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTiersExpirationAll(BaseModel): + """ + Defines the Loyalty Tiers Expiration. + """ # noqa: E501 + qualification_type: Optional[StrictStr] = Field(default=None, description="Tier qualification. `BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold.") + qualification_period: Optional[StrictStr] = Field(default=None, description="Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. | **Period** | **Definition** | |:---|:---| | **Calendar Month** | Points collected in one calendar month
January, February, March, etc. | | **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December | | **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December | | **Calendar Year** | Points collected in one calendar year
January - December |") + start_date: Optional[LoyaltyTiersExpirationAllStartDate] = None + expiration_date: Optional[LoyaltyTiersExpirationAllExpirationDate] = None + __properties: ClassVar[List[str]] = ["qualification_type", "qualification_period", "start_date", "expiration_date"] + + @field_validator('qualification_type') + def qualification_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['BALANCE', 'POINTS_IN_PERIOD']): + raise ValueError("must be one of enum values ('BALANCE', 'POINTS_IN_PERIOD')") + return value + + @field_validator('qualification_period') + def qualification_period_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MONTH', 'QUARTER', 'HALF_YEAR', 'YEAR']): + raise ValueError("must be one of enum values ('MONTH', 'QUARTER', 'HALF_YEAR', 'YEAR')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAll 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 start_date + if self.start_date: + _dict['start_date'] = self.start_date.to_dict() + # override the default output from pydantic by calling `to_dict()` of expiration_date + if self.expiration_date: + _dict['expiration_date'] = self.expiration_date.to_dict() + # set to None if qualification_type (nullable) is None + # and model_fields_set contains the field + if self.qualification_type is None and "qualification_type" in self.model_fields_set: + _dict['qualification_type'] = None + + # set to None if qualification_period (nullable) is None + # and model_fields_set contains the field + if self.qualification_period is None and "qualification_period" in self.model_fields_set: + _dict['qualification_period'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAll from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "qualification_type": obj.get("qualification_type"), + "qualification_period": obj.get("qualification_period"), + "start_date": LoyaltyTiersExpirationAllStartDate.from_dict(obj["start_date"]) if obj.get("start_date") is not None else None, + "expiration_date": LoyaltyTiersExpirationAllExpirationDate.from_dict(obj["expiration_date"]) if obj.get("expiration_date") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_tiers_expiration_all_expiration_date.py b/voucherify/models/loyalty_tiers_expiration_all_expiration_date.py new file mode 100644 index 00000000..b3c47ff1 --- /dev/null +++ b/voucherify/models/loyalty_tiers_expiration_all_expiration_date.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.loyalty_tiers_expiration_all_expiration_date_rounding import LoyaltyTiersExpirationAllExpirationDateRounding +from typing import Optional, Set +from typing_extensions import Self + +class LoyaltyTiersExpirationAllExpirationDate(BaseModel): + """ + Defines the conditions for the expiration date of a tier. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="What triggers the tier to expire for a customer. `END_OF_PERIOD`: Expire tier at the end of the period. `END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.") + extend: Optional[StrictStr] = Field(default=None, description="Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day.") + rounding: Optional[LoyaltyTiersExpirationAllExpirationDateRounding] = None + __properties: ClassVar[List[str]] = ["type", "extend", "rounding"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['END_OF_PERIOD', 'END_OF_NEXT_PERIOD', 'BALANCE_DROP', 'CUSTOM']): + raise ValueError("must be one of enum values ('END_OF_PERIOD', 'END_OF_NEXT_PERIOD', 'BALANCE_DROP', 'CUSTOM')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAllExpirationDate 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 rounding + if self.rounding: + _dict['rounding'] = self.rounding.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if extend (nullable) is None + # and model_fields_set contains the field + if self.extend is None and "extend" in self.model_fields_set: + _dict['extend'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAllExpirationDate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "extend": obj.get("extend"), + "rounding": LoyaltyTiersExpirationAllExpirationDateRounding.from_dict(obj["rounding"]) if obj.get("rounding") is not None else None + }) + return _obj + + diff --git a/voucherify/models/loyalty_tiers_expiration_all_expiration_date_rounding.py b/voucherify/models/loyalty_tiers_expiration_all_expiration_date_rounding.py new file mode 100644 index 00000000..f5c3eedd --- /dev/null +++ b/voucherify/models/loyalty_tiers_expiration_all_expiration_date_rounding.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class LoyaltyTiersExpirationAllExpirationDateRounding(BaseModel): + """ + Defines the rounding mechanism for tier expiration. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="This mechanism describes a custom rounding for the expiration date.") + strategy: Optional[StrictStr] = Field(default=None, description="This mechanism describes a rounding strategy for the expiration date.") + unit: Optional[StrictStr] = Field(default='MONTH', description="Defines the type of unit of time in which the rounding period is counted.") + value: Optional[StrictInt] = Field(default=None, description="Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. - `0`: January - `1`: February - `2`: March - `3`: April - `4`: May - `5`: June - `6`: July - `7`: August - `8`: September - `9`: October - `10`: November - `11`: December") + __properties: ClassVar[List[str]] = ["type", "strategy", "unit", "value"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MONTH', 'QUARTER', 'HALF_YEAR', 'YEAR', 'CUSTOM']): + raise ValueError("must be one of enum values ('MONTH', 'QUARTER', 'HALF_YEAR', 'YEAR', 'CUSTOM')") + return value + + @field_validator('strategy') + def strategy_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['START', 'END']): + raise ValueError("must be one of enum values ('START', 'END')") + return value + + @field_validator('unit') + def unit_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MONTH']): + raise ValueError("must be one of enum values ('MONTH')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAllExpirationDateRounding 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, + ) + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if strategy (nullable) is None + # and model_fields_set contains the field + if self.strategy is None and "strategy" in self.model_fields_set: + _dict['strategy'] = None + + # set to None if unit (nullable) is None + # and model_fields_set contains the field + if self.unit is None and "unit" in self.model_fields_set: + _dict['unit'] = None + + # set to None if value (nullable) is None + # and model_fields_set contains the field + if self.value is None and "value" in self.model_fields_set: + _dict['value'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAllExpirationDateRounding from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "strategy": obj.get("strategy"), + "unit": obj.get("unit") if obj.get("unit") is not None else 'MONTH', + "value": obj.get("value") + }) + return _obj + + diff --git a/voucherify/models/loyalty_tiers_expiration_all_start_date.py b/voucherify/models/loyalty_tiers_expiration_all_start_date.py new file mode 100644 index 00000000..c01e9879 --- /dev/null +++ b/voucherify/models/loyalty_tiers_expiration_all_start_date.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class LoyaltyTiersExpirationAllStartDate(BaseModel): + """ + Defines the conditions for the start date of the tier. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="What triggers the tier to be valid for a customer. `IMMEDIATE`: After reaching the minimum required points. `NEXT_PERIOD`: When the next qualification period starts.") + __properties: ClassVar[List[str]] = ["type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['IMMEDIATE', 'NEXT_PERIOD']): + raise ValueError("must be one of enum values ('IMMEDIATE', 'NEXT_PERIOD')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAllStartDate 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, + ) + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoyaltyTiersExpirationAllStartDate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/lucky_draw.py b/voucherify/models/lucky_draw.py new file mode 100644 index 00000000..3301c51b --- /dev/null +++ b/voucherify/models/lucky_draw.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class LuckyDraw(BaseModel): + """ + Object for defining detailed information about lucky draw should be applied + """ # noqa: E501 + winners_count: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="It represents the total number of winners in a lucky draw.") + unique_winners_per_draw: Optional[StrictStr] = Field(default=None, description="It indicates whether each winner in a draw is unique or not.") + unique_winners: Optional[StrictStr] = Field(default=None, description="Specifies whether each participant can win only once across multiple draws.") + __properties: ClassVar[List[str]] = ["winners_count", "unique_winners_per_draw", "unique_winners"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LuckyDraw 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, + ) + # set to None if winners_count (nullable) is None + # and model_fields_set contains the field + if self.winners_count is None and "winners_count" in self.model_fields_set: + _dict['winners_count'] = None + + # set to None if unique_winners_per_draw (nullable) is None + # and model_fields_set contains the field + if self.unique_winners_per_draw is None and "unique_winners_per_draw" in self.model_fields_set: + _dict['unique_winners_per_draw'] = None + + # set to None if unique_winners (nullable) is None + # and model_fields_set contains the field + if self.unique_winners is None and "unique_winners" in self.model_fields_set: + _dict['unique_winners'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LuckyDraw from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "winners_count": obj.get("winners_count"), + "unique_winners_per_draw": obj.get("unique_winners_per_draw"), + "unique_winners": obj.get("unique_winners") + }) + return _obj + + diff --git a/voucherify/models/member_activity.py b/voucherify/models/member_activity.py new file mode 100644 index 00000000..954271aa --- /dev/null +++ b/voucherify/models/member_activity.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class MemberActivity(BaseModel): + """ + This is an object representing member activity. This is a general object which presents moments from members' activity. There are all types of different events that members perform during their journey once they participate in a loyalty program. Events describe moments when the members redeem loyalty cards and earn points or rewards. The list of all types of activities is listed below. The details describing the activity are collected in an array property named `data`. In this object, software integrators can find all further information explaining the event context. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique event ID, assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Event type.") + data: Optional[Dict[str, Any]] = Field(default=None, description="Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the member activity occurred in ISO 8601 format.") + group_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the request that caused the event.") + __properties: ClassVar[List[str]] = ["id", "type", "data", "created_at", "group_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MemberActivity 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if group_id (nullable) is None + # and model_fields_set contains the field + if self.group_id is None and "group_id" in self.model_fields_set: + _dict['group_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MemberActivity 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"), + "type": obj.get("type"), + "data": obj.get("data"), + "created_at": obj.get("created_at"), + "group_id": obj.get("group_id") + }) + return _obj + + diff --git a/voucherify/models/order.py b/voucherify/models/order.py new file mode 100644 index 00000000..1833bebd --- /dev/null +++ b/voucherify/models/order.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_item import OrderItem +from typing import Optional, Set +from typing_extensions import Self + +class Order(BaseModel): + """ + Order information. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items: Optional[List[OrderItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items", "metadata"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Order 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Order 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items": [OrderItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/order_calculated.py b/voucherify/models/order_calculated.py new file mode 100644 index 00000000..99e14b4c --- /dev/null +++ b/voucherify/models/order_calculated.py @@ -0,0 +1,267 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer_id import CustomerId +from voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.referrer_id import ReferrerId +from typing import Optional, Set +from typing_extensions import Self + +class OrderCalculated(BaseModel): + """ + Order information. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied to the order.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied to the order.") + total_amount: Optional[StrictInt] = Field(default=None, description="Order amount after undoing all the discounts through the rollback redemption.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + items_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)`") + total_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`") + items: Optional[List[OrderCalculatedItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + object: Optional[StrictStr] = Field(default='order', description="The type of the object represented by JSON.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was last updated in ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[CustomerId] = None + referrer: Optional[ReferrerId] = None + redemptions: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items_discount_amount", "total_discount_amount", "total_amount", "applied_discount_amount", "items_applied_discount_amount", "total_applied_discount_amount", "items", "metadata", "object", "created_at", "updated_at", "customer_id", "referrer_id", "customer", "referrer", "redemptions"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderCalculated 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_discount_amount is None and "items_discount_amount" in self.model_fields_set: + _dict['items_discount_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if items_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_applied_discount_amount is None and "items_applied_discount_amount" in self.model_fields_set: + _dict['items_applied_discount_amount'] = None + + # set to None if total_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_applied_discount_amount is None and "total_applied_discount_amount" in self.model_fields_set: + _dict['total_applied_discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderCalculated 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items_discount_amount": obj.get("items_discount_amount"), + "total_discount_amount": obj.get("total_discount_amount"), + "total_amount": obj.get("total_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "items_applied_discount_amount": obj.get("items_applied_discount_amount"), + "total_applied_discount_amount": obj.get("total_applied_discount_amount"), + "items": [OrderCalculatedItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'order', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "customer_id": obj.get("customer_id"), + "referrer_id": obj.get("referrer_id"), + "customer": CustomerId.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": ReferrerId.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None, + "redemptions": obj.get("redemptions") + }) + return _obj + + diff --git a/voucherify/models/order_calculated_item.py b/voucherify/models/order_calculated_item.py new file mode 100644 index 00000000..ff4f83fe --- /dev/null +++ b/voucherify/models/order_calculated_item.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated_item_product import OrderCalculatedItemProduct +from voucherify.models.order_calculated_item_sku import OrderCalculatedItemSku +from typing import Optional, Set +from typing_extensions import Self + +class OrderCalculatedItem(BaseModel): + """ + OrderCalculatedItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the order line item.") + sku_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the SKU. It is assigned by Voucherify.") + product_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the product. It is assigned by Voucherify.") + related_object: Optional[StrictStr] = Field(default=None, description="Used along with the source_id property, can be set to either sku or product.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service.") + quantity: Optional[StrictInt] = Field(default=None, description="The quantity of the particular item in the cart.") + discount_quantity: Optional[StrictInt] = Field(default=None, description="Number of dicounted items.") + initial_quantity: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity.") + amount: Optional[StrictInt] = Field(default=None, description="The total amount of the order item (price * quantity).") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-item-level discounts applied to the order.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + applied_discount_quantity: Optional[StrictInt] = Field(default=None, description="Number of the discounted items applied in the transaction.") + applied_quantity: Optional[StrictInt] = Field(default=None, description="Quantity of items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced.") + applied_quantity_amount: Optional[StrictInt] = Field(default=None, description="Amount for the items changed by the application of a new quantity items. It can be positive when an item is added or negative if an item is replaced.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + price: Optional[StrictInt] = Field(default=None, description="Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + subtotal_amount: Optional[StrictInt] = Field(default=None, description="Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. `subtotal_amount`=`amount`-`applied_discount_amount`") + product: Optional[OrderCalculatedItemProduct] = None + sku: Optional[OrderCalculatedItemSku] = None + object: Optional[StrictStr] = Field(default='order_item', description="The type of the object represented by JSON.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format.") + __properties: ClassVar[List[str]] = ["id", "sku_id", "product_id", "related_object", "source_id", "quantity", "discount_quantity", "initial_quantity", "amount", "discount_amount", "applied_discount_amount", "applied_discount_quantity", "applied_quantity", "applied_quantity_amount", "initial_amount", "price", "subtotal_amount", "product", "sku", "object", "metadata"] + + @field_validator('related_object') + def related_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product', 'sku']): + raise ValueError("must be one of enum values ('product', 'sku')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order_item']): + raise ValueError("must be one of enum values ('order_item')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderCalculatedItem 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 product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of sku + if self.sku: + _dict['sku'] = self.sku.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if sku_id (nullable) is None + # and model_fields_set contains the field + if self.sku_id is None and "sku_id" in self.model_fields_set: + _dict['sku_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if related_object (nullable) is None + # and model_fields_set contains the field + if self.related_object is None and "related_object" in self.model_fields_set: + _dict['related_object'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if discount_quantity (nullable) is None + # and model_fields_set contains the field + if self.discount_quantity is None and "discount_quantity" in self.model_fields_set: + _dict['discount_quantity'] = None + + # set to None if initial_quantity (nullable) is None + # and model_fields_set contains the field + if self.initial_quantity is None and "initial_quantity" in self.model_fields_set: + _dict['initial_quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if applied_discount_quantity (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_quantity is None and "applied_discount_quantity" in self.model_fields_set: + _dict['applied_discount_quantity'] = None + + # set to None if applied_quantity (nullable) is None + # and model_fields_set contains the field + if self.applied_quantity is None and "applied_quantity" in self.model_fields_set: + _dict['applied_quantity'] = None + + # set to None if applied_quantity_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_quantity_amount is None and "applied_quantity_amount" in self.model_fields_set: + _dict['applied_quantity_amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if subtotal_amount (nullable) is None + # and model_fields_set contains the field + if self.subtotal_amount is None and "subtotal_amount" in self.model_fields_set: + _dict['subtotal_amount'] = None + + # set to None if product (nullable) is None + # and model_fields_set contains the field + if self.product is None and "product" in self.model_fields_set: + _dict['product'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderCalculatedItem 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"), + "sku_id": obj.get("sku_id"), + "product_id": obj.get("product_id"), + "related_object": obj.get("related_object"), + "source_id": obj.get("source_id"), + "quantity": obj.get("quantity"), + "discount_quantity": obj.get("discount_quantity"), + "initial_quantity": obj.get("initial_quantity"), + "amount": obj.get("amount"), + "discount_amount": obj.get("discount_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "applied_discount_quantity": obj.get("applied_discount_quantity"), + "applied_quantity": obj.get("applied_quantity"), + "applied_quantity_amount": obj.get("applied_quantity_amount"), + "initial_amount": obj.get("initial_amount"), + "price": obj.get("price"), + "subtotal_amount": obj.get("subtotal_amount"), + "product": OrderCalculatedItemProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sku": OrderCalculatedItemSku.from_dict(obj["sku"]) if obj.get("sku") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'order_item', + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/order_calculated_item_product.py b/voucherify/models/order_calculated_item_product.py new file mode 100644 index 00000000..ef68663a --- /dev/null +++ b/voucherify/models/order_calculated_item_product.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class OrderCalculatedItemProduct(BaseModel): + """ + An object containing details of the related product. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the product and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service.") + override: Optional[StrictBool] = Field(default=None, description="The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system.") + name: Optional[StrictStr] = Field(default=None, description="Product name.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format.") + price: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["id", "source_id", "override", "name", "metadata", "price"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderCalculatedItemProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if override (nullable) is None + # and model_fields_set contains the field + if self.override is None and "override" in self.model_fields_set: + _dict['override'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderCalculatedItemProduct 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"), + "source_id": obj.get("source_id"), + "override": obj.get("override"), + "name": obj.get("name"), + "metadata": obj.get("metadata"), + "price": obj.get("price") + }) + return _obj + + diff --git a/voucherify/models/order_calculated_item_sku.py b/voucherify/models/order_calculated_item_sku.py new file mode 100644 index 00000000..be75e0e7 --- /dev/null +++ b/voucherify/models/order_calculated_item_sku.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class OrderCalculatedItemSku(BaseModel): + """ + An object containing details of the related SKU. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the SKU and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service.") + override: Optional[StrictBool] = Field(default=None, description="The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system.") + sku: Optional[StrictStr] = Field(default=None, description="The SKU name.") + price: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["id", "source_id", "override", "sku", "price"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderCalculatedItemSku 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if override (nullable) is None + # and model_fields_set contains the field + if self.override is None and "override" in self.model_fields_set: + _dict['override'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderCalculatedItemSku 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"), + "source_id": obj.get("source_id"), + "override": obj.get("override"), + "sku": obj.get("sku"), + "price": obj.get("price") + }) + return _obj + + diff --git a/voucherify/models/order_item.py b/voucherify/models/order_item.py new file mode 100644 index 00000000..1dc36df3 --- /dev/null +++ b/voucherify/models/order_item.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_item_product import OrderItemProduct +from voucherify.models.order_item_sku import OrderItemSku +from typing import Optional, Set +from typing_extensions import Self + +class OrderItem(BaseModel): + """ + OrderItem + """ # noqa: E501 + sku_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the SKU. It is assigned by Voucherify.") + product_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the product. It is assigned by Voucherify.") + related_object: Optional[StrictStr] = Field(default=None, description="Used along with the source_id property, can be set to either sku or product.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's product/SKU ID (if it is different from the Voucherify product/SKU ID). It is useful in the integration between multiple systems. It can be an ID from an eCommerce site, a database, or a third-party service.") + quantity: Optional[StrictInt] = Field(default=None, description="The quantity of the particular item in the cart.") + discount_quantity: Optional[StrictInt] = Field(default=None, description="Number of dicounted items.") + initial_quantity: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest unit quantity representing the total amount of the order; this is the sum of the order items' quantity.") + amount: Optional[StrictInt] = Field(default=None, description="The total amount of the order item (price * quantity).") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-item-level discounts applied to the order.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + price: Optional[StrictInt] = Field(default=None, description="Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + product: Optional[OrderItemProduct] = None + sku: Optional[OrderItemSku] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order item. It can be useful for storing additional information about the order item in a structured format.") + __properties: ClassVar[List[str]] = ["sku_id", "product_id", "related_object", "source_id", "quantity", "discount_quantity", "initial_quantity", "amount", "discount_amount", "initial_amount", "price", "product", "sku", "metadata"] + + @field_validator('related_object') + def related_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product', 'sku']): + raise ValueError("must be one of enum values ('product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderItem 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 product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of sku + if self.sku: + _dict['sku'] = self.sku.to_dict() + # set to None if sku_id (nullable) is None + # and model_fields_set contains the field + if self.sku_id is None and "sku_id" in self.model_fields_set: + _dict['sku_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if related_object (nullable) is None + # and model_fields_set contains the field + if self.related_object is None and "related_object" in self.model_fields_set: + _dict['related_object'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if discount_quantity (nullable) is None + # and model_fields_set contains the field + if self.discount_quantity is None and "discount_quantity" in self.model_fields_set: + _dict['discount_quantity'] = None + + # set to None if initial_quantity (nullable) is None + # and model_fields_set contains the field + if self.initial_quantity is None and "initial_quantity" in self.model_fields_set: + _dict['initial_quantity'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if product (nullable) is None + # and model_fields_set contains the field + if self.product is None and "product" in self.model_fields_set: + _dict['product'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sku_id": obj.get("sku_id"), + "product_id": obj.get("product_id"), + "related_object": obj.get("related_object"), + "source_id": obj.get("source_id"), + "quantity": obj.get("quantity"), + "discount_quantity": obj.get("discount_quantity"), + "initial_quantity": obj.get("initial_quantity"), + "amount": obj.get("amount"), + "discount_amount": obj.get("discount_amount"), + "initial_amount": obj.get("initial_amount"), + "price": obj.get("price"), + "product": OrderItemProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sku": OrderItemSku.from_dict(obj["sku"]) if obj.get("sku") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/order_item_product.py b/voucherify/models/order_item_product.py new file mode 100644 index 00000000..6787b3d6 --- /dev/null +++ b/voucherify/models/order_item_product.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class OrderItemProduct(BaseModel): + """ + An object containing details of the related product. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the product and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service.") + override: Optional[StrictBool] = Field(default=None, description="The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system.") + name: Optional[StrictStr] = Field(default=None, description="Product name.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format.") + price: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Product price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["id", "source_id", "override", "name", "metadata", "price"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderItemProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if override (nullable) is None + # and model_fields_set contains the field + if self.override is None and "override" in self.model_fields_set: + _dict['override'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderItemProduct 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"), + "source_id": obj.get("source_id"), + "override": obj.get("override"), + "name": obj.get("name"), + "metadata": obj.get("metadata"), + "price": obj.get("price") + }) + return _obj + + diff --git a/voucherify/models/order_item_sku.py b/voucherify/models/order_item_sku.py new file mode 100644 index 00000000..50d22c73 --- /dev/null +++ b/voucherify/models/order_item_sku.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class OrderItemSku(BaseModel): + """ + An object containing details of the related SKU. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the SKU and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service.") + override: Optional[StrictBool] = Field(default=None, description="The override set to `true` is used to store the product information in the system. If the product does not exist, it will be created with a source_id; if it does exist, the provided values for the name, price, and metadata will replace those already stored in the system.") + sku: Optional[StrictStr] = Field(default=None, description="The SKU name.") + price: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="SKU price. A positive integer in the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["id", "source_id", "override", "sku", "price"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderItemSku 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if override (nullable) is None + # and model_fields_set contains the field + if self.override is None and "override" in self.model_fields_set: + _dict['override'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderItemSku 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"), + "source_id": obj.get("source_id"), + "override": obj.get("override"), + "sku": obj.get("sku"), + "price": obj.get("price") + }) + return _obj + + diff --git a/voucherify/models/orders_create_request_body.py b/voucherify/models/orders_create_request_body.py new file mode 100644 index 00000000..8026d0d5 --- /dev/null +++ b/voucherify/models/orders_create_request_body.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer import Customer +from voucherify.models.order_item import OrderItem +from voucherify.models.referrer import Referrer +from typing import Optional, Set +from typing_extensions import Self + +class OrdersCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/orders`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items: Optional[List[OrderItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[Customer] = None + referrer: Optional[Referrer] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items", "metadata", "created_at", "referrer_id", "customer", "referrer"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersCreateRequestBody 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersCreateRequestBody 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items": [OrderItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "referrer_id": obj.get("referrer_id"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": Referrer.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None + }) + return _obj + + diff --git a/voucherify/models/orders_create_response_body.py b/voucherify/models/orders_create_response_body.py new file mode 100644 index 00000000..ecd7a8c2 --- /dev/null +++ b/voucherify/models/orders_create_response_body.py @@ -0,0 +1,267 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer_id import CustomerId +from voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.referrer_id import ReferrerId +from typing import Optional, Set +from typing_extensions import Self + +class OrdersCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/orders`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied to the order.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied to the order.") + total_amount: Optional[StrictInt] = Field(default=None, description="Order amount after undoing all the discounts through the rollback redemption.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + items_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)`") + total_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`") + items: Optional[List[OrderCalculatedItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + object: Optional[StrictStr] = Field(default='order', description="The type of the object represented by JSON.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was last updated in ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[CustomerId] = None + referrer: Optional[ReferrerId] = None + redemptions: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items_discount_amount", "total_discount_amount", "total_amount", "applied_discount_amount", "items_applied_discount_amount", "total_applied_discount_amount", "items", "metadata", "object", "created_at", "updated_at", "customer_id", "referrer_id", "customer", "referrer", "redemptions"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersCreateResponseBody 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_discount_amount is None and "items_discount_amount" in self.model_fields_set: + _dict['items_discount_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if items_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_applied_discount_amount is None and "items_applied_discount_amount" in self.model_fields_set: + _dict['items_applied_discount_amount'] = None + + # set to None if total_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_applied_discount_amount is None and "total_applied_discount_amount" in self.model_fields_set: + _dict['total_applied_discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersCreateResponseBody 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items_discount_amount": obj.get("items_discount_amount"), + "total_discount_amount": obj.get("total_discount_amount"), + "total_amount": obj.get("total_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "items_applied_discount_amount": obj.get("items_applied_discount_amount"), + "total_applied_discount_amount": obj.get("total_applied_discount_amount"), + "items": [OrderCalculatedItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'order', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "customer_id": obj.get("customer_id"), + "referrer_id": obj.get("referrer_id"), + "customer": CustomerId.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": ReferrerId.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None, + "redemptions": obj.get("redemptions") + }) + return _obj + + diff --git a/voucherify/models/orders_export_create_request_body.py b/voucherify/models/orders_export_create_request_body.py new file mode 100644 index 00000000..a9eb983d --- /dev/null +++ b/voucherify/models/orders_export_create_request_body.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.orders_export_create_request_body_parameters import OrdersExportCreateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class OrdersExportCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/orders/export`. + """ # noqa: E501 + parameters: Optional[OrdersExportCreateRequestBodyParameters] = None + __properties: ClassVar[List[str]] = ["parameters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersExportCreateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersExportCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parameters": OrdersExportCreateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/orders_export_create_request_body_parameters.py b/voucherify/models/orders_export_create_request_body_parameters.py new file mode 100644 index 00000000..7f545a0e --- /dev/null +++ b/voucherify/models/orders_export_create_request_body_parameters.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.export_order_fields import ExportOrderFields +from voucherify.models.export_order_order import ExportOrderOrder +from typing import Optional, Set +from typing_extensions import Self + +class OrdersExportCreateRequestBodyParameters(BaseModel): + """ + List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + """ # noqa: E501 + order: Optional[ExportOrderOrder] = None + fields: Optional[List[ExportOrderFields]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[Dict[str, Any]] = Field(default=None, description="Allowed additional properties must start with \"metadata.\"") + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersExportCreateRequestBodyParameters 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, + ) + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersExportCreateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": obj.get("filters") + }) + return _obj + + diff --git a/voucherify/models/orders_export_create_response_body.py b/voucherify/models/orders_export_create_response_body.py new file mode 100644 index 00000000..3901a7cf --- /dev/null +++ b/voucherify/models/orders_export_create_response_body.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.orders_export_create_response_body_parameters import OrdersExportCreateResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class OrdersExportCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/orders/export`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique export ID.") + object: Optional[StrictStr] = Field(default='export', description="The type of object being represented. This object stores information about the export.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the export was scheduled in ISO 8601 format.") + status: Optional[StrictStr] = Field(default='SCHEDULED', description="Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.") + channel: Optional[StrictStr] = Field(default=None, description="The channel through which the export was triggered.") + result: Optional[Dict[str, Any]] = Field(default=None, description="Contains the URL of the CSV file.") + user_id: Optional[StrictStr] = Field(default=None, description="Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.") + exported_object: Optional[StrictStr] = Field(default='order', description="The type of object to be exported.") + parameters: Optional[OrdersExportCreateResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "status", "channel", "result", "user_id", "exported_object", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['export']): + raise ValueError("must be one of enum values ('export')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SCHEDULED']): + raise ValueError("must be one of enum values ('SCHEDULED')") + return value + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersExportCreateResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersExportCreateResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'export', + "created_at": obj.get("created_at"), + "status": obj.get("status") if obj.get("status") is not None else 'SCHEDULED', + "channel": obj.get("channel"), + "result": obj.get("result"), + "user_id": obj.get("user_id"), + "exported_object": obj.get("exported_object") if obj.get("exported_object") is not None else 'order', + "parameters": OrdersExportCreateResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/orders_export_create_response_body_parameters.py b/voucherify/models/orders_export_create_response_body_parameters.py new file mode 100644 index 00000000..37553e26 --- /dev/null +++ b/voucherify/models/orders_export_create_response_body_parameters.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.export_order_fields import ExportOrderFields +from voucherify.models.export_order_order import ExportOrderOrder +from typing import Optional, Set +from typing_extensions import Self + +class OrdersExportCreateResponseBodyParameters(BaseModel): + """ + List of available fields and filters that can be exported with an order along with the sorting order of the returned data. + """ # noqa: E501 + order: Optional[ExportOrderOrder] = None + fields: Optional[List[ExportOrderFields]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file.") + filters: Optional[Dict[str, Any]] = Field(default=None, description="Allowed additional properties must start with \"metadata.\"") + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersExportCreateResponseBodyParameters 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, + ) + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersExportCreateResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": obj.get("filters") + }) + return _obj + + diff --git a/voucherify/models/orders_get_response_body.py b/voucherify/models/orders_get_response_body.py new file mode 100644 index 00000000..1e7eefc8 --- /dev/null +++ b/voucherify/models/orders_get_response_body.py @@ -0,0 +1,267 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer_id import CustomerId +from voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.referrer_id import ReferrerId +from typing import Optional, Set +from typing_extensions import Self + +class OrdersGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/orders/{orderId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied to the order.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied to the order.") + total_amount: Optional[StrictInt] = Field(default=None, description="Order amount after undoing all the discounts through the rollback redemption.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + items_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)`") + total_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`") + items: Optional[List[OrderCalculatedItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + object: Optional[StrictStr] = Field(default='order', description="The type of the object represented by JSON.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was last updated in ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[CustomerId] = None + referrer: Optional[ReferrerId] = None + redemptions: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items_discount_amount", "total_discount_amount", "total_amount", "applied_discount_amount", "items_applied_discount_amount", "total_applied_discount_amount", "items", "metadata", "object", "created_at", "updated_at", "customer_id", "referrer_id", "customer", "referrer", "redemptions"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersGetResponseBody 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_discount_amount is None and "items_discount_amount" in self.model_fields_set: + _dict['items_discount_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if items_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_applied_discount_amount is None and "items_applied_discount_amount" in self.model_fields_set: + _dict['items_applied_discount_amount'] = None + + # set to None if total_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_applied_discount_amount is None and "total_applied_discount_amount" in self.model_fields_set: + _dict['total_applied_discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersGetResponseBody 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items_discount_amount": obj.get("items_discount_amount"), + "total_discount_amount": obj.get("total_discount_amount"), + "total_amount": obj.get("total_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "items_applied_discount_amount": obj.get("items_applied_discount_amount"), + "total_applied_discount_amount": obj.get("total_applied_discount_amount"), + "items": [OrderCalculatedItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'order', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "customer_id": obj.get("customer_id"), + "referrer_id": obj.get("referrer_id"), + "customer": CustomerId.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": ReferrerId.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None, + "redemptions": obj.get("redemptions") + }) + return _obj + + diff --git a/voucherify/models/orders_import_create_request_body_item.py b/voucherify/models/orders_import_create_request_body_item.py new file mode 100644 index 00000000..a3a1022b --- /dev/null +++ b/voucherify/models/orders_import_create_request_body_item.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer import Customer +from voucherify.models.order_item import OrderItem +from voucherify.models.referrer import Referrer +from typing import Optional, Set +from typing_extensions import Self + +class OrdersImportCreateRequestBodyItem(BaseModel): + """ + OrdersImportCreateRequestBodyItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items: Optional[List[OrderItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[Customer] = None + referrer: Optional[Referrer] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items", "metadata", "created_at", "referrer_id", "customer", "referrer"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersImportCreateRequestBodyItem 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersImportCreateRequestBodyItem 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items": [OrderItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "referrer_id": obj.get("referrer_id"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": Referrer.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None + }) + return _obj + + diff --git a/voucherify/models/orders_import_create_response_body.py b/voucherify/models/orders_import_create_response_body.py new file mode 100644 index 00000000..72457e9b --- /dev/null +++ b/voucherify/models/orders_import_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OrdersImportCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/orders/import`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersImportCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersImportCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/orders_list_response_body.py b/voucherify/models/orders_list_response_body.py new file mode 100644 index 00000000..77dc26a3 --- /dev/null +++ b/voucherify/models/orders_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated import OrderCalculated +from typing import Optional, Set +from typing_extensions import Self + +class OrdersListResponseBody(BaseModel): + """ + Response body schema representing **GET** `v1/orders`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about orders in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='orders', description="Identifies the name of the attribute that contains the array of order objects.") + orders: Optional[List[OrderCalculated]] = Field(default=None, description="Contains array of order objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of orders.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "orders", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['orders']): + raise ValueError("must be one of enum values ('orders')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersListResponseBody 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 orders (list) + _items = [] + if self.orders: + for _item_orders in self.orders: + if _item_orders: + _items.append(_item_orders.to_dict()) + _dict['orders'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'orders', + "orders": [OrderCalculated.from_dict(_item) for _item in obj["orders"]] if obj.get("orders") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/orders_update_request_body.py b/voucherify/models/orders_update_request_body.py new file mode 100644 index 00000000..af2e9dae --- /dev/null +++ b/voucherify/models/orders_update_request_body.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer import Customer +from voucherify.models.order_item import OrderItem +from voucherify.models.referrer import Referrer +from typing import Optional, Set +from typing_extensions import Self + +class OrdersUpdateRequestBody(BaseModel): + """ + Request body schema for **PUT** `v1/orders/{orderId}`. + """ # noqa: E501 + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items: Optional[List[OrderItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[Customer] = None + referrer: Optional[Referrer] = None + __properties: ClassVar[List[str]] = ["source_id", "status", "amount", "initial_amount", "discount_amount", "items", "metadata", "created_at", "referrer_id", "customer", "referrer"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersUpdateRequestBody 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items": [OrderItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "referrer_id": obj.get("referrer_id"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": Referrer.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None + }) + return _obj + + diff --git a/voucherify/models/orders_update_response_body.py b/voucherify/models/orders_update_response_body.py new file mode 100644 index 00000000..2c07b21d --- /dev/null +++ b/voucherify/models/orders_update_response_body.py @@ -0,0 +1,267 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer_id import CustomerId +from voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.referrer_id import ReferrerId +from typing import Optional, Set +from typing_extensions import Self + +class OrdersUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/orders/{orderId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied to the order.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied to the order.") + total_amount: Optional[StrictInt] = Field(default=None, description="Order amount after undoing all the discounts through the rollback redemption.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + items_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)`") + total_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`") + items: Optional[List[OrderCalculatedItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format.") + object: Optional[StrictStr] = Field(default='order', description="The type of the object represented by JSON.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was last updated in ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[CustomerId] = None + referrer: Optional[ReferrerId] = None + redemptions: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items_discount_amount", "total_discount_amount", "total_amount", "applied_discount_amount", "items_applied_discount_amount", "total_applied_discount_amount", "items", "metadata", "object", "created_at", "updated_at", "customer_id", "referrer_id", "customer", "referrer", "redemptions"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrdersUpdateResponseBody 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_discount_amount is None and "items_discount_amount" in self.model_fields_set: + _dict['items_discount_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if items_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_applied_discount_amount is None and "items_applied_discount_amount" in self.model_fields_set: + _dict['items_applied_discount_amount'] = None + + # set to None if total_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_applied_discount_amount is None and "total_applied_discount_amount" in self.model_fields_set: + _dict['total_applied_discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrdersUpdateResponseBody 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items_discount_amount": obj.get("items_discount_amount"), + "total_discount_amount": obj.get("total_discount_amount"), + "total_amount": obj.get("total_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "items_applied_discount_amount": obj.get("items_applied_discount_amount"), + "total_applied_discount_amount": obj.get("total_applied_discount_amount"), + "items": [OrderCalculatedItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'order', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "customer_id": obj.get("customer_id"), + "referrer_id": obj.get("referrer_id"), + "customer": CustomerId.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": ReferrerId.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None, + "redemptions": obj.get("redemptions") + }) + return _obj + + diff --git a/voucherify/models/parameter_activity_category.py b/voucherify/models/parameter_activity_category.py new file mode 100644 index 00000000..850aecf2 --- /dev/null +++ b/voucherify/models/parameter_activity_category.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterActivityCategory(str, Enum): + """ + ParameterActivityCategory + """ + + """ + allowed enum values + """ + ACTION = 'ACTION' + EFFECT = 'EFFECT' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterActivityCategory from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_campaign_type.py b/voucherify/models/parameter_campaign_type.py new file mode 100644 index 00000000..040f3f0f --- /dev/null +++ b/voucherify/models/parameter_campaign_type.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterCampaignType(str, Enum): + """ + ParameterCampaignType + """ + + """ + allowed enum values + """ + PROMOTION = 'PROMOTION' + GIFT_VOUCHERS = 'GIFT_VOUCHERS' + REFERRAL_PROGRAM = 'REFERRAL_PROGRAM' + DISCOUNT_COUPONS = 'DISCOUNT_COUPONS' + LOYALTY_PROGRAM = 'LOYALTY_PROGRAM' + LUCKY_DRAW = 'LUCKY_DRAW' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterCampaignType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_created_before_after.py b/voucherify/models/parameter_created_before_after.py new file mode 100644 index 00000000..3c69610c --- /dev/null +++ b/voucherify/models/parameter_created_before_after.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ParameterCreatedBeforeAfter(BaseModel): + """ + ParameterCreatedBeforeAfter + """ # noqa: E501 + before: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time before the voucher was created. The value is shown in the ISO 8601 format.") + after: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time after the voucher was created. The value is shown in the ISO 8601 format.") + __properties: ClassVar[List[str]] = ["before", "after"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterCreatedBeforeAfter 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, + ) + # set to None if before (nullable) is None + # and model_fields_set contains the field + if self.before is None and "before" in self.model_fields_set: + _dict['before'] = None + + # set to None if after (nullable) is None + # and model_fields_set contains the field + if self.after is None and "after" in self.model_fields_set: + _dict['after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterCreatedBeforeAfter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "before": obj.get("before"), + "after": obj.get("after") + }) + return _obj + + diff --git a/voucherify/models/parameter_expand_list_campaigns.py b/voucherify/models/parameter_expand_list_campaigns.py new file mode 100644 index 00000000..30c715fa --- /dev/null +++ b/voucherify/models/parameter_expand_list_campaigns.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterExpandListCampaigns(str, Enum): + """ + ParameterExpandListCampaigns + """ + + """ + allowed enum values + """ + CATEGORY = 'category' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterExpandListCampaigns from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables.py b/voucherify/models/parameter_filters_list_customer_redeemables.py new file mode 100644 index 00000000..da4fef5f --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables.py @@ -0,0 +1,174 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_id import ParameterFiltersListCustomerRedeemablesCampaignId +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_type import ParameterFiltersListCustomerRedeemablesCampaignType +from voucherify.models.parameter_filters_list_customer_redeemables_created_at import ParameterFiltersListCustomerRedeemablesCreatedAt +from voucherify.models.parameter_filters_list_customer_redeemables_holder_role import ParameterFiltersListCustomerRedeemablesHolderRole +from voucherify.models.parameter_filters_list_customer_redeemables_id import ParameterFiltersListCustomerRedeemablesId +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_id import ParameterFiltersListCustomerRedeemablesRedeemableId +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_object import ParameterFiltersListCustomerRedeemablesRedeemableObject +from voucherify.models.parameter_filters_list_customer_redeemables_voucher_type import ParameterFiltersListCustomerRedeemablesVoucherType +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemables(BaseModel): + """ + ParameterFiltersListCustomerRedeemables + """ # noqa: E501 + id: Optional[ParameterFiltersListCustomerRedeemablesId] = None + created_at: Optional[ParameterFiltersListCustomerRedeemablesCreatedAt] = None + redeemable_id: Optional[ParameterFiltersListCustomerRedeemablesRedeemableId] = None + redeemable_object: Optional[ParameterFiltersListCustomerRedeemablesRedeemableObject] = None + holder_role: Optional[ParameterFiltersListCustomerRedeemablesHolderRole] = None + campaign_id: Optional[ParameterFiltersListCustomerRedeemablesCampaignId] = None + campaign_type: Optional[ParameterFiltersListCustomerRedeemablesCampaignType] = None + voucher_type: Optional[ParameterFiltersListCustomerRedeemablesVoucherType] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "redeemable_id", "redeemable_object", "holder_role", "campaign_id", "campaign_type", "voucher_type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemables 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 id + if self.id: + _dict['id'] = self.id.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + # override the default output from pydantic by calling `to_dict()` of redeemable_id + if self.redeemable_id: + _dict['redeemable_id'] = self.redeemable_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of redeemable_object + if self.redeemable_object: + _dict['redeemable_object'] = self.redeemable_object.to_dict() + # override the default output from pydantic by calling `to_dict()` of holder_role + if self.holder_role: + _dict['holder_role'] = self.holder_role.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_type + if self.campaign_type: + _dict['campaign_type'] = self.campaign_type.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher_type + if self.voucher_type: + _dict['voucher_type'] = self.voucher_type.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if redeemable_id (nullable) is None + # and model_fields_set contains the field + if self.redeemable_id is None and "redeemable_id" in self.model_fields_set: + _dict['redeemable_id'] = None + + # set to None if redeemable_object (nullable) is None + # and model_fields_set contains the field + if self.redeemable_object is None and "redeemable_object" in self.model_fields_set: + _dict['redeemable_object'] = None + + # set to None if holder_role (nullable) is None + # and model_fields_set contains the field + if self.holder_role is None and "holder_role" in self.model_fields_set: + _dict['holder_role'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if voucher_type (nullable) is None + # and model_fields_set contains the field + if self.voucher_type is None and "voucher_type" in self.model_fields_set: + _dict['voucher_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemables from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": ParameterFiltersListCustomerRedeemablesId.from_dict(obj["id"]) if obj.get("id") is not None else None, + "created_at": ParameterFiltersListCustomerRedeemablesCreatedAt.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None, + "redeemable_id": ParameterFiltersListCustomerRedeemablesRedeemableId.from_dict(obj["redeemable_id"]) if obj.get("redeemable_id") is not None else None, + "redeemable_object": ParameterFiltersListCustomerRedeemablesRedeemableObject.from_dict(obj["redeemable_object"]) if obj.get("redeemable_object") is not None else None, + "holder_role": ParameterFiltersListCustomerRedeemablesHolderRole.from_dict(obj["holder_role"]) if obj.get("holder_role") is not None else None, + "campaign_id": ParameterFiltersListCustomerRedeemablesCampaignId.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None, + "campaign_type": ParameterFiltersListCustomerRedeemablesCampaignType.from_dict(obj["campaign_type"]) if obj.get("campaign_type") is not None else None, + "voucher_type": ParameterFiltersListCustomerRedeemablesVoucherType.from_dict(obj["voucher_type"]) if obj.get("voucher_type") is not None else None + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_campaign_id.py b/voucherify/models/parameter_filters_list_customer_redeemables_campaign_id.py new file mode 100644 index 00000000..a82a30f4 --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_campaign_id.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesCampaignId(BaseModel): + """ + Unique campaign identifer, e.g. `camp_bfrwAVsP6Q1EM1ZjgHwheKYr`. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCampaignId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCampaignId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_campaign_type.py b/voucherify/models/parameter_filters_list_customer_redeemables_campaign_type.py new file mode 100644 index 00000000..a41cf1de --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_campaign_type.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.parameter_filters_list_customer_redeemables_campaign_type_conditions import ParameterFiltersListCustomerRedeemablesCampaignTypeConditions +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesCampaignType(BaseModel): + """ + Type of the campaign. Allowed values: `DISCOUNT_COUPONS`, `REFERRAL_PROGRAM`, `GIFT_VOUCHERS`, `LOYALTY_PROGRAM` + """ # noqa: E501 + conditions: Optional[ParameterFiltersListCustomerRedeemablesCampaignTypeConditions] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCampaignType 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCampaignType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": ParameterFiltersListCustomerRedeemablesCampaignTypeConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_campaign_type_conditions.py b/voucherify/models/parameter_filters_list_customer_redeemables_campaign_type_conditions.py new file mode 100644 index 00000000..a3edbcc9 --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_campaign_type_conditions.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesCampaignTypeConditions(BaseModel): + """ + ParameterFiltersListCustomerRedeemablesCampaignTypeConditions + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Value is exactly this value (single value).", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results omit this value (single value).", alias="$is_not") + has_value: Optional[StrictStr] = Field(default=None, description="Value is NOT null. The value for this parameter is an empty string.", alias="$has_value") + is_unknown: Optional[StrictStr] = Field(default=None, description="Value is null. The value for this parameter is an empty string.", alias="$is_unknown") + starts_with: Optional[StrictStr] = Field(default=None, description="Value starts with the specified string.", alias="$starts_with") + ends_with: Optional[StrictStr] = Field(default=None, description="Value ends with the specified string.", alias="$ends_with") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not", "$has_value", "$is_unknown", "$starts_with", "$ends_with"] + + @field_validator('var_in') + def var_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM']): + raise ValueError("each list item must be one of ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM')") + return value + + @field_validator('not_in') + def not_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM']): + raise ValueError("each list item must be one of ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM')") + return value + + @field_validator('var_is') + def var_is_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM')") + return value + + @field_validator('is_not') + def is_not_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM']): + raise ValueError("must be one of enum values ('LOYALTY_PROGRAM', 'GIFT_VOUCHERS', 'DISCOUNT_COUPONS', 'REFERRAL_PROGRAM')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCampaignTypeConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if starts_with (nullable) is None + # and model_fields_set contains the field + if self.starts_with is None and "starts_with" in self.model_fields_set: + _dict['$starts_with'] = None + + # set to None if ends_with (nullable) is None + # and model_fields_set contains the field + if self.ends_with is None and "ends_with" in self.model_fields_set: + _dict['$ends_with'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCampaignTypeConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "$starts_with": obj.get("$starts_with"), + "$ends_with": obj.get("$ends_with") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_created_at.py b/voucherify/models/parameter_filters_list_customer_redeemables_created_at.py new file mode 100644 index 00000000..e241b5f7 --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_created_at.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.parameter_filters_list_customer_redeemables_created_at_conditions import ParameterFiltersListCustomerRedeemablesCreatedAtConditions +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesCreatedAt(BaseModel): + """ + Timestamp representing the date and time when the customer redeemable was created. The value is shown in the ISO 8601 format. + """ # noqa: E501 + conditions: Optional[ParameterFiltersListCustomerRedeemablesCreatedAtConditions] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCreatedAt 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCreatedAt from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": ParameterFiltersListCustomerRedeemablesCreatedAtConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_created_at_conditions.py b/voucherify/models/parameter_filters_list_customer_redeemables_created_at_conditions.py new file mode 100644 index 00000000..0532233c --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_created_at_conditions.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesCreatedAtConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + after: Optional[datetime] = Field(default=None, description="Value is after this date. The value for this parameter is shown in the ISO 8601 format.", alias="$after") + before: Optional[datetime] = Field(default=None, description="Value is before this date. The value for this parameter is shown in the ISO 8601 format.", alias="$before") + has_value: Optional[StrictStr] = Field(default=None, description="Value is NOT null. The value for this parameter is an empty string.", alias="$has_value") + is_unknown: Optional[StrictStr] = Field(default=None, description="Value is null. The value for this parameter is an empty string.", alias="$is_unknown") + more_than: Optional[StrictInt] = Field(default=None, description="Value is more days ago before the current date and time, e.g. more than `10` days ago.") + less_than: Optional[StrictInt] = Field(default=None, description="Value is less days before the current date and time, e.g. less than `10` days ago.") + __properties: ClassVar[List[str]] = ["$after", "$before", "$has_value", "$is_unknown", "more_than", "less_than"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCreatedAtConditions 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, + ) + # set to None if after (nullable) is None + # and model_fields_set contains the field + if self.after is None and "after" in self.model_fields_set: + _dict['$after'] = None + + # set to None if before (nullable) is None + # and model_fields_set contains the field + if self.before is None and "before" in self.model_fields_set: + _dict['$before'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if more_than (nullable) is None + # and model_fields_set contains the field + if self.more_than is None and "more_than" in self.model_fields_set: + _dict['more_than'] = None + + # set to None if less_than (nullable) is None + # and model_fields_set contains the field + if self.less_than is None and "less_than" in self.model_fields_set: + _dict['less_than'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesCreatedAtConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$after": obj.get("$after"), + "$before": obj.get("$before"), + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "more_than": obj.get("more_than"), + "less_than": obj.get("less_than") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_holder_role.py b/voucherify/models/parameter_filters_list_customer_redeemables_holder_role.py new file mode 100644 index 00000000..b7fce07a --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_holder_role.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.parameter_filters_list_customer_redeemables_holder_role_conditions import ParameterFiltersListCustomerRedeemablesHolderRoleConditions +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesHolderRole(BaseModel): + """ + Holder role of the redeemable. Allowed values: `OWNER`, `REFEREE`, `REFERRER`. + """ # noqa: E501 + conditions: Optional[ParameterFiltersListCustomerRedeemablesHolderRoleConditions] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesHolderRole 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesHolderRole from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": ParameterFiltersListCustomerRedeemablesHolderRoleConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_holder_role_conditions.py b/voucherify/models/parameter_filters_list_customer_redeemables_holder_role_conditions.py new file mode 100644 index 00000000..2661a6ec --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_holder_role_conditions.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesHolderRoleConditions(BaseModel): + """ + ParameterFiltersListCustomerRedeemablesHolderRoleConditions + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Value is exactly this value (single value).", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results omit this value (single value).", alias="$is_not") + has_value: Optional[StrictStr] = Field(default=None, description="Value is NOT null. The value for this parameter is an empty string.", alias="$has_value") + is_unknown: Optional[StrictStr] = Field(default=None, description="Value is null. The value for this parameter is an empty string.", alias="$is_unknown") + starts_with: Optional[StrictStr] = Field(default=None, description="Value starts with the specified string.", alias="$starts_with") + ends_with: Optional[StrictStr] = Field(default=None, description="Value ends with the specified string.", alias="$ends_with") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not", "$has_value", "$is_unknown", "$starts_with", "$ends_with"] + + @field_validator('var_in') + def var_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['OWNER', 'REFEREE', 'REFERRER']): + raise ValueError("each list item must be one of ('OWNER', 'REFEREE', 'REFERRER')") + return value + + @field_validator('not_in') + def not_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['OWNER', 'REFEREE', 'REFERRER']): + raise ValueError("each list item must be one of ('OWNER', 'REFEREE', 'REFERRER')") + return value + + @field_validator('var_is') + def var_is_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['OWNER', 'REFEREE', 'REFERRER']): + raise ValueError("must be one of enum values ('OWNER', 'REFEREE', 'REFERRER')") + return value + + @field_validator('is_not') + def is_not_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['OWNER', 'REFEREE', 'REFERRER']): + raise ValueError("must be one of enum values ('OWNER', 'REFEREE', 'REFERRER')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesHolderRoleConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if starts_with (nullable) is None + # and model_fields_set contains the field + if self.starts_with is None and "starts_with" in self.model_fields_set: + _dict['$starts_with'] = None + + # set to None if ends_with (nullable) is None + # and model_fields_set contains the field + if self.ends_with is None and "ends_with" in self.model_fields_set: + _dict['$ends_with'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesHolderRoleConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "$starts_with": obj.get("$starts_with"), + "$ends_with": obj.get("$ends_with") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_id.py b/voucherify/models/parameter_filters_list_customer_redeemables_id.py new file mode 100644 index 00000000..f940c0a4 --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_id.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesId(BaseModel): + """ + Unique redeemable holder ID, i.e. `rh_0e77502f84f0f4a6a8`. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_id.py b/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_id.py new file mode 100644 index 00000000..0fa74f66 --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_id.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesRedeemableId(BaseModel): + """ + Unique redeemable ID, e.g. `v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk`. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesRedeemableId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesRedeemableId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_object.py b/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_object.py new file mode 100644 index 00000000..ff1d5417 --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_object.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.parameter_filters_list_customer_redeemables_redeemable_object_conditions import ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesRedeemableObject(BaseModel): + """ + Unique related object, i.e. `voucher`. + """ # noqa: E501 + conditions: Optional[ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesRedeemableObject 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesRedeemableObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_object_conditions.py b/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_object_conditions.py new file mode 100644 index 00000000..0fb85eee --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_redeemable_object_conditions.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions(BaseModel): + """ + ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$not_in") + var_is: Optional[StrictStr] = Field(default='voucher', description="Value is exactly this value (single value).", alias="$is") + is_not: Optional[StrictStr] = Field(default='voucher', description="Results omit this value (single value).", alias="$is_not") + has_value: Optional[StrictStr] = Field(default=None, description="Value is NOT null. The value for this parameter is an empty string.", alias="$has_value") + is_unknown: Optional[StrictStr] = Field(default=None, description="Value is null. The value for this parameter is an empty string.", alias="$is_unknown") + starts_with: Optional[StrictStr] = Field(default=None, description="Value starts with the specified string.", alias="$starts_with") + ends_with: Optional[StrictStr] = Field(default=None, description="Value ends with the specified string.", alias="$ends_with") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not", "$has_value", "$is_unknown", "$starts_with", "$ends_with"] + + @field_validator('var_in') + def var_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['voucher']): + raise ValueError("each list item must be one of ('voucher')") + return value + + @field_validator('not_in') + def not_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['voucher']): + raise ValueError("each list item must be one of ('voucher')") + return value + + @field_validator('var_is') + def var_is_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + @field_validator('is_not') + def is_not_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if starts_with (nullable) is None + # and model_fields_set contains the field + if self.starts_with is None and "starts_with" in self.model_fields_set: + _dict['$starts_with'] = None + + # set to None if ends_with (nullable) is None + # and model_fields_set contains the field + if self.ends_with is None and "ends_with" in self.model_fields_set: + _dict['$ends_with'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesRedeemableObjectConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is") if obj.get("$is") is not None else 'voucher', + "$is_not": obj.get("$is_not") if obj.get("$is_not") is not None else 'voucher', + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "$starts_with": obj.get("$starts_with"), + "$ends_with": obj.get("$ends_with") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_voucher_type.py b/voucherify/models/parameter_filters_list_customer_redeemables_voucher_type.py new file mode 100644 index 00000000..fef821da --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_voucher_type.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.parameter_filters_list_customer_redeemables_voucher_type_conditions import ParameterFiltersListCustomerRedeemablesVoucherTypeConditions +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesVoucherType(BaseModel): + """ + Type of the voucher. Allowed values: `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD`. + """ # noqa: E501 + conditions: Optional[ParameterFiltersListCustomerRedeemablesVoucherTypeConditions] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesVoucherType 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesVoucherType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": ParameterFiltersListCustomerRedeemablesVoucherTypeConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_customer_redeemables_voucher_type_conditions.py b/voucherify/models/parameter_filters_list_customer_redeemables_voucher_type_conditions.py new file mode 100644 index 00000000..6f5cee66 --- /dev/null +++ b/voucherify/models/parameter_filters_list_customer_redeemables_voucher_type_conditions.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListCustomerRedeemablesVoucherTypeConditions(BaseModel): + """ + ParameterFiltersListCustomerRedeemablesVoucherTypeConditions + """ # noqa: E501 + var_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Array of resource values that should be included in the results (multiple values).", alias="$not_in") + var_is: Optional[StrictStr] = Field(default=None, description="Value is exactly this value (single value).", alias="$is") + is_not: Optional[StrictStr] = Field(default=None, description="Results omit this value (single value).", alias="$is_not") + has_value: Optional[StrictStr] = Field(default=None, description="Value is NOT null. The value for this parameter is an empty string.", alias="$has_value") + is_unknown: Optional[StrictStr] = Field(default=None, description="Value is null. The value for this parameter is an empty string.", alias="$is_unknown") + starts_with: Optional[StrictStr] = Field(default=None, description="Value starts with the specified string.", alias="$starts_with") + ends_with: Optional[StrictStr] = Field(default=None, description="Value ends with the specified string.", alias="$ends_with") + __properties: ClassVar[List[str]] = ["$in", "$not_in", "$is", "$is_not", "$has_value", "$is_unknown", "$starts_with", "$ends_with"] + + @field_validator('var_in') + def var_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("each list item must be one of ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('not_in') + def not_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("each list item must be one of ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('var_is') + def var_is_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('is_not') + def is_not_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesVoucherTypeConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if starts_with (nullable) is None + # and model_fields_set contains the field + if self.starts_with is None and "starts_with" in self.model_fields_set: + _dict['$starts_with'] = None + + # set to None if ends_with (nullable) is None + # and model_fields_set contains the field + if self.ends_with is None and "ends_with" in self.model_fields_set: + _dict['$ends_with'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListCustomerRedeemablesVoucherTypeConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in"), + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "$starts_with": obj.get("$starts_with"), + "$ends_with": obj.get("$ends_with") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions.py b/voucherify/models/parameter_filters_list_redemptions.py new file mode 100644 index 00000000..53dbb7f6 --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions.py @@ -0,0 +1,196 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.parameter_filters_list_redemptions_campaign_name import ParameterFiltersListRedemptionsCampaignName +from voucherify.models.parameter_filters_list_redemptions_customer_id import ParameterFiltersListRedemptionsCustomerId +from voucherify.models.parameter_filters_list_redemptions_failure_code import ParameterFiltersListRedemptionsFailureCode +from voucherify.models.parameter_filters_list_redemptions_object import ParameterFiltersListRedemptionsObject +from voucherify.models.parameter_filters_list_redemptions_parent_redemption_id import ParameterFiltersListRedemptionsParentRedemptionId +from voucherify.models.parameter_filters_list_redemptions_related_object_id import ParameterFiltersListRedemptionsRelatedObjectId +from voucherify.models.parameter_filters_list_redemptions_related_object_parent_id import ParameterFiltersListRedemptionsRelatedObjectParentId +from voucherify.models.parameter_filters_list_redemptions_result import ParameterFiltersListRedemptionsResult +from voucherify.models.parameter_filters_list_redemptions_user_login import ParameterFiltersListRedemptionsUserLogin +from voucherify.models.parameter_filters_list_redemptions_voucher_code import ParameterFiltersListRedemptionsVoucherCode +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptions(BaseModel): + """ + ParameterFiltersListRedemptions + """ # noqa: E501 + voucher_code: Optional[ParameterFiltersListRedemptionsVoucherCode] = None + related_object_id: Optional[ParameterFiltersListRedemptionsRelatedObjectId] = None + related_object_parent_id: Optional[ParameterFiltersListRedemptionsRelatedObjectParentId] = None + parent_redemption_id: Optional[ParameterFiltersListRedemptionsParentRedemptionId] = None + failure_code: Optional[ParameterFiltersListRedemptionsFailureCode] = None + result: Optional[ParameterFiltersListRedemptionsResult] = None + object: Optional[ParameterFiltersListRedemptionsObject] = None + customer_id: Optional[ParameterFiltersListRedemptionsCustomerId] = None + campaign_name: Optional[ParameterFiltersListRedemptionsCampaignName] = None + user_login: Optional[ParameterFiltersListRedemptionsUserLogin] = None + __properties: ClassVar[List[str]] = ["voucher_code", "related_object_id", "related_object_parent_id", "parent_redemption_id", "failure_code", "result", "object", "customer_id", "campaign_name", "user_login"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptions 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 voucher_code + if self.voucher_code: + _dict['voucher_code'] = self.voucher_code.to_dict() + # override the default output from pydantic by calling `to_dict()` of related_object_id + if self.related_object_id: + _dict['related_object_id'] = self.related_object_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of related_object_parent_id + if self.related_object_parent_id: + _dict['related_object_parent_id'] = self.related_object_parent_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of parent_redemption_id + if self.parent_redemption_id: + _dict['parent_redemption_id'] = self.parent_redemption_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of failure_code + if self.failure_code: + _dict['failure_code'] = self.failure_code.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of object + if self.object: + _dict['object'] = self.object.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer_id + if self.customer_id: + _dict['customer_id'] = self.customer_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_name + if self.campaign_name: + _dict['campaign_name'] = self.campaign_name.to_dict() + # override the default output from pydantic by calling `to_dict()` of user_login + if self.user_login: + _dict['user_login'] = self.user_login.to_dict() + # set to None if voucher_code (nullable) is None + # and model_fields_set contains the field + if self.voucher_code is None and "voucher_code" in self.model_fields_set: + _dict['voucher_code'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_parent_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_parent_id is None and "related_object_parent_id" in self.model_fields_set: + _dict['related_object_parent_id'] = None + + # set to None if parent_redemption_id (nullable) is None + # and model_fields_set contains the field + if self.parent_redemption_id is None and "parent_redemption_id" in self.model_fields_set: + _dict['parent_redemption_id'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if campaign_name (nullable) is None + # and model_fields_set contains the field + if self.campaign_name is None and "campaign_name" in self.model_fields_set: + _dict['campaign_name'] = None + + # set to None if user_login (nullable) is None + # and model_fields_set contains the field + if self.user_login is None and "user_login" in self.model_fields_set: + _dict['user_login'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "voucher_code": ParameterFiltersListRedemptionsVoucherCode.from_dict(obj["voucher_code"]) if obj.get("voucher_code") is not None else None, + "related_object_id": ParameterFiltersListRedemptionsRelatedObjectId.from_dict(obj["related_object_id"]) if obj.get("related_object_id") is not None else None, + "related_object_parent_id": ParameterFiltersListRedemptionsRelatedObjectParentId.from_dict(obj["related_object_parent_id"]) if obj.get("related_object_parent_id") is not None else None, + "parent_redemption_id": ParameterFiltersListRedemptionsParentRedemptionId.from_dict(obj["parent_redemption_id"]) if obj.get("parent_redemption_id") is not None else None, + "failure_code": ParameterFiltersListRedemptionsFailureCode.from_dict(obj["failure_code"]) if obj.get("failure_code") is not None else None, + "result": ParameterFiltersListRedemptionsResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "object": ParameterFiltersListRedemptionsObject.from_dict(obj["object"]) if obj.get("object") is not None else None, + "customer_id": ParameterFiltersListRedemptionsCustomerId.from_dict(obj["customer_id"]) if obj.get("customer_id") is not None else None, + "campaign_name": ParameterFiltersListRedemptionsCampaignName.from_dict(obj["campaign_name"]) if obj.get("campaign_name") is not None else None, + "user_login": ParameterFiltersListRedemptionsUserLogin.from_dict(obj["user_login"]) if obj.get("user_login") is not None else None + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_campaign_name.py b/voucherify/models/parameter_filters_list_redemptions_campaign_name.py new file mode 100644 index 00000000..5c99ed09 --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_campaign_name.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsCampaignName(BaseModel): + """ + Campaign name. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsCampaignName 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsCampaignName from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_customer_id.py b/voucherify/models/parameter_filters_list_redemptions_customer_id.py new file mode 100644 index 00000000..411703cb --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_customer_id.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsCustomerId(BaseModel): + """ + Unique customer ID, i.e. cust_sehkNIi8Uq2qQuRqSr7xn4Zi. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsCustomerId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsCustomerId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_failure_code.py b/voucherify/models/parameter_filters_list_redemptions_failure_code.py new file mode 100644 index 00000000..b1757be8 --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_failure_code.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsFailureCode(BaseModel): + """ + Failure code, i.e. quantity_exceeded. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsFailureCode 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsFailureCode from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_object.py b/voucherify/models/parameter_filters_list_redemptions_object.py new file mode 100644 index 00000000..8cc0966e --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_object.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsObject(BaseModel): + """ + Specify which type of object to return, i.e. `redemption` or `redemption_rollback`. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsObject 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_parent_redemption_id.py b/voucherify/models/parameter_filters_list_redemptions_parent_redemption_id.py new file mode 100644 index 00000000..80a48994 --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_parent_redemption_id.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsParentRedemptionId(BaseModel): + """ + Unique parent redemption ID, i.e. r_0c5952900bcbfd54b6. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsParentRedemptionId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsParentRedemptionId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_related_object_id.py b/voucherify/models/parameter_filters_list_redemptions_related_object_id.py new file mode 100644 index 00000000..25cb60e6 --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_related_object_id.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsRelatedObjectId(BaseModel): + """ + Unique related object ID, i.e. v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsRelatedObjectId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsRelatedObjectId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_related_object_parent_id.py b/voucherify/models/parameter_filters_list_redemptions_related_object_parent_id.py new file mode 100644 index 00000000..1b62da4b --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_related_object_parent_id.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsRelatedObjectParentId(BaseModel): + """ + Unique related object parent ID, i.e. camp_22noMlhTADb7Fq2UL3vWu3d1. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsRelatedObjectParentId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsRelatedObjectParentId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_result.py b/voucherify/models/parameter_filters_list_redemptions_result.py new file mode 100644 index 00000000..b30e79a7 --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_result.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsResult(BaseModel): + """ + Result, i.e. `SUCCESS` or `FAILURE`. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsResult 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_user_login.py b/voucherify/models/parameter_filters_list_redemptions_user_login.py new file mode 100644 index 00000000..322748df --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_user_login.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsUserLogin(BaseModel): + """ + User login used to login to Voucherify, i.e. name.lastname@email.com + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsUserLogin 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsUserLogin from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_filters_list_redemptions_voucher_code.py b/voucherify/models/parameter_filters_list_redemptions_voucher_code.py new file mode 100644 index 00000000..fc42e972 --- /dev/null +++ b/voucherify/models/parameter_filters_list_redemptions_voucher_code.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.filter_conditions_string import FilterConditionsString +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ParameterFiltersListRedemptionsVoucherCode(BaseModel): + """ + Unique voucher code. + """ # noqa: E501 + conditions: Optional[FilterConditionsString] = None + junction: Optional[Junction] = None + __properties: ClassVar[List[str]] = ["conditions", "junction"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsVoucherCode 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterFiltersListRedemptionsVoucherCode from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": FilterConditionsString.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None, + "junction": obj.get("junction") + }) + return _obj + + diff --git a/voucherify/models/parameter_order.py b/voucherify/models/parameter_order.py new file mode 100644 index 00000000..d1b38322 --- /dev/null +++ b/voucherify/models/parameter_order.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrder(str, Enum): + """ + ParameterOrder + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + TYPE = 'type' + MINUS_TYPE = '-type' + CODE = 'code' + MINUS_CODE = '-code' + CAMPAIGN = 'campaign' + MINUS_CAMPAIGN = '-campaign' + CATEGORY = 'category' + MINUS_CATEGORY = '-category' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrder from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_created_at.py b/voucherify/models/parameter_order_created_at.py new file mode 100644 index 00000000..9817a40e --- /dev/null +++ b/voucherify/models/parameter_order_created_at.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderCreatedAt(str, Enum): + """ + ParameterOrderCreatedAt + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderCreatedAt from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_all_promotion_stacks.py b/voucherify/models/parameter_order_list_all_promotion_stacks.py new file mode 100644 index 00000000..089e2f19 --- /dev/null +++ b/voucherify/models/parameter_order_list_all_promotion_stacks.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListAllPromotionStacks(str, Enum): + """ + ParameterOrderListAllPromotionStacks + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + NAME = 'name' + MINUS_NAME = '-name' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListAllPromotionStacks from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_campaigns.py b/voucherify/models/parameter_order_list_campaigns.py new file mode 100644 index 00000000..d790bd5c --- /dev/null +++ b/voucherify/models/parameter_order_list_campaigns.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListCampaigns(str, Enum): + """ + ParameterOrderListCampaigns + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListCampaigns from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_customers.py b/voucherify/models/parameter_order_list_customers.py new file mode 100644 index 00000000..63574770 --- /dev/null +++ b/voucherify/models/parameter_order_list_customers.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListCustomers(str, Enum): + """ + ParameterOrderListCustomers + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + SOURCE_ID = 'source_id' + MINUS_SOURCE_ID = '-source_id' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListCustomers from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_earning_rules.py b/voucherify/models/parameter_order_list_earning_rules.py new file mode 100644 index 00000000..089ea5c4 --- /dev/null +++ b/voucherify/models/parameter_order_list_earning_rules.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListEarningRules(str, Enum): + """ + ParameterOrderListEarningRules + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListEarningRules from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_exports.py b/voucherify/models/parameter_order_list_exports.py new file mode 100644 index 00000000..9e4b244b --- /dev/null +++ b/voucherify/models/parameter_order_list_exports.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListExports(str, Enum): + """ + ParameterOrderListExports + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + STATUS = 'status' + MINUS_STATUS = '-status' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListExports from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_loyalty_tiers.py b/voucherify/models/parameter_order_list_loyalty_tiers.py new file mode 100644 index 00000000..282bb886 --- /dev/null +++ b/voucherify/models/parameter_order_list_loyalty_tiers.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListLoyaltyTiers(str, Enum): + """ + ParameterOrderListLoyaltyTiers + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListLoyaltyTiers from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_orders.py b/voucherify/models/parameter_order_list_orders.py new file mode 100644 index 00000000..2a8e2af4 --- /dev/null +++ b/voucherify/models/parameter_order_list_orders.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListOrders(str, Enum): + """ + ParameterOrderListOrders + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListOrders from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_promotion_tiers.py b/voucherify/models/parameter_order_list_promotion_tiers.py new file mode 100644 index 00000000..a4cba5ac --- /dev/null +++ b/voucherify/models/parameter_order_list_promotion_tiers.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListPromotionTiers(str, Enum): + """ + ParameterOrderListPromotionTiers + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListPromotionTiers from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_promotion_tiers_client_side.py b/voucherify/models/parameter_order_list_promotion_tiers_client_side.py new file mode 100644 index 00000000..2fcac0f9 --- /dev/null +++ b/voucherify/models/parameter_order_list_promotion_tiers_client_side.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListPromotionTiersClientSide(str, Enum): + """ + ParameterOrderListPromotionTiersClientSide + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListPromotionTiersClientSide from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_publications.py b/voucherify/models/parameter_order_list_publications.py new file mode 100644 index 00000000..97a0da5b --- /dev/null +++ b/voucherify/models/parameter_order_list_publications.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListPublications(str, Enum): + """ + ParameterOrderListPublications + """ + + """ + allowed enum values + """ + ID = 'id' + MINUS_ID = '-id' + VOUCHER_CODE = 'voucher_code' + MINUS_VOUCHER_CODE = '-voucher_code' + TRACKING_ID = 'tracking_id' + MINUS_TRACKING_ID = '-tracking_id' + CUSTOMER_ID = 'customer_id' + MINUS_CUSTOMER_ID = '-customer_id' + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + CHANNEL = 'channel' + MINUS_CHANNEL = '-channel' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListPublications from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_redeemables.py b/voucherify/models/parameter_order_list_redeemables.py new file mode 100644 index 00000000..7d351ad7 --- /dev/null +++ b/voucherify/models/parameter_order_list_redeemables.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListRedeemables(str, Enum): + """ + ParameterOrderListRedeemables + """ + + """ + allowed enum values + """ + ID = 'id' + MINUS_ID = '-id' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListRedeemables from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_redemptions.py b/voucherify/models/parameter_order_list_redemptions.py new file mode 100644 index 00000000..427444a1 --- /dev/null +++ b/voucherify/models/parameter_order_list_redemptions.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListRedemptions(str, Enum): + """ + ParameterOrderListRedemptions + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + ID = 'id' + MINUS_ID = '-id' + VOUCHER_CODE = 'voucher_code' + MINUS_VOUCHER_CODE = '-voucher_code' + TRACKING_ID = 'tracking_id' + MINUS_TRACKING_ID = '-tracking_id' + CUSTOMER_ID = 'customer_id' + MINUS_CUSTOMER_ID = '-customer_id' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListRedemptions from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_transactions.py b/voucherify/models/parameter_order_list_transactions.py new file mode 100644 index 00000000..1bf1dfda --- /dev/null +++ b/voucherify/models/parameter_order_list_transactions.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListTransactions(str, Enum): + """ + ParameterOrderListTransactions + """ + + """ + allowed enum values + """ + ID = 'id' + MINUS_ID = '-id' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListTransactions from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_validation_rule_assignments.py b/voucherify/models/parameter_order_list_validation_rule_assignments.py new file mode 100644 index 00000000..96c0c70e --- /dev/null +++ b/voucherify/models/parameter_order_list_validation_rule_assignments.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListValidationRuleAssignments(str, Enum): + """ + ParameterOrderListValidationRuleAssignments + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListValidationRuleAssignments from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_list_validation_rules.py b/voucherify/models/parameter_order_list_validation_rules.py new file mode 100644 index 00000000..ab1df12e --- /dev/null +++ b/voucherify/models/parameter_order_list_validation_rules.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderListValidationRules(str, Enum): + """ + ParameterOrderListValidationRules + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + NAME = 'name' + MINUS_NAME = '-name' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderListValidationRules from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_order_vouchers.py b/voucherify/models/parameter_order_vouchers.py new file mode 100644 index 00000000..6d6f89ce --- /dev/null +++ b/voucherify/models/parameter_order_vouchers.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterOrderVouchers(str, Enum): + """ + ParameterOrderVouchers + """ + + """ + allowed enum values + """ + CREATED_AT = 'created_at' + MINUS_CREATED_AT = '-created_at' + UPDATED_AT = 'updated_at' + MINUS_UPDATED_AT = '-updated_at' + CODE = 'code' + MINUS_CODE = '-code' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterOrderVouchers from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_result_list_publications.py b/voucherify/models/parameter_result_list_publications.py new file mode 100644 index 00000000..4969b7f5 --- /dev/null +++ b/voucherify/models/parameter_result_list_publications.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterResultListPublications(str, Enum): + """ + ParameterResultListPublications + """ + + """ + allowed enum values + """ + SUCCESS = 'SUCCESS' + FAILURE = 'FAILURE' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterResultListPublications from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/parameter_updated_before_after.py b/voucherify/models/parameter_updated_before_after.py new file mode 100644 index 00000000..2df3ecc5 --- /dev/null +++ b/voucherify/models/parameter_updated_before_after.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ParameterUpdatedBeforeAfter(BaseModel): + """ + ParameterUpdatedBeforeAfter + """ # noqa: E501 + before: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time before the voucher was updated. The value is shown in the ISO 8601 format.") + after: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time after the voucher was updated. The value is shown in the ISO 8601 format.") + __properties: ClassVar[List[str]] = ["before", "after"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ParameterUpdatedBeforeAfter 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, + ) + # set to None if before (nullable) is None + # and model_fields_set contains the field + if self.before is None and "before" in self.model_fields_set: + _dict['before'] = None + + # set to None if after (nullable) is None + # and model_fields_set contains the field + if self.after is None and "after" in self.model_fields_set: + _dict['after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ParameterUpdatedBeforeAfter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "before": obj.get("before"), + "after": obj.get("after") + }) + return _obj + + diff --git a/voucherify/models/parameter_voucher_type_list_publications.py b/voucherify/models/parameter_voucher_type_list_publications.py new file mode 100644 index 00000000..b8b2beab --- /dev/null +++ b/voucherify/models/parameter_voucher_type_list_publications.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ParameterVoucherTypeListPublications(str, Enum): + """ + ParameterVoucherTypeListPublications + """ + + """ + allowed enum values + """ + DISCOUNT = 'discount' + LOYALTY = 'loyalty' + LUCKY_DRAW = 'lucky_draw' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ParameterVoucherTypeListPublications from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/points_expiration_types.py b/voucherify/models/points_expiration_types.py new file mode 100644 index 00000000..24aa5982 --- /dev/null +++ b/voucherify/models/points_expiration_types.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class PointsExpirationTypes(str, Enum): + """ + PointsExpirationTypes + """ + + """ + allowed enum values + """ + PROGRAM_RULES = 'PROGRAM_RULES' + CUSTOM_DATE = 'CUSTOM_DATE' + NON_EXPIRING = 'NON_EXPIRING' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PointsExpirationTypes from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/product.py b/voucherify/models/product.py new file mode 100644 index 00000000..30660ab6 --- /dev/null +++ b/voucherify/models/product.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.skus_list_for_product import SkusListForProduct +from typing import Optional, Set +from typing_extensions import Self + +class Product(BaseModel): + """ + This is an object representing a product. This entity should be used to map product items from your inventory management system. The aim of products is to build which reflect product-specific campaigns. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique product source ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='product', description="The type of the object represented by JSON. This object stores information about the product.") + skus: Optional[SkusListForProduct] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "price", "attributes", "metadata", "image_url", "created_at", "updated_at", "object", "skus"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product']): + raise ValueError("must be one of enum values ('product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Product 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 skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Product 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'product', + "skus": SkusListForProduct.from_dict(obj["skus"]) if obj.get("skus") is not None else None + }) + return _obj + + diff --git a/voucherify/models/product_collections_create_request_body.py b/voucherify/models/product_collections_create_request_body.py new file mode 100644 index 00000000..aafcab0d --- /dev/null +++ b/voucherify/models/product_collections_create_request_body.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.product_collections_create_request_body_filter import ProductCollectionsCreateRequestBodyFilter +from voucherify.models.product_collections_create_request_body_products_item import ProductCollectionsCreateRequestBodyProductsItem +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsCreateRequestBody(BaseModel): + """ + ProductCollectionsCreateRequestBody + """ # noqa: E501 + type: Optional[StrictStr] = Field(default='STATIC', description="Show that the product collection is static (manually selected products).") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product collection name.") + products: Optional[List[ProductCollectionsCreateRequestBodyProductsItem]] = Field(default=None, description="Defines a set of products for a `STATIC` product collection type.") + filter: Optional[ProductCollectionsCreateRequestBodyFilter] = None + __properties: ClassVar[List[str]] = ["type", "name", "products", "filter"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['STATIC']): + raise ValueError("must be one of enum values ('STATIC')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateRequestBody 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 products (list) + _items = [] + if self.products: + for _item_products in self.products: + if _item_products: + _items.append(_item_products.to_dict()) + _dict['products'] = _items + # override the default output from pydantic by calling `to_dict()` of filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if products (nullable) is None + # and model_fields_set contains the field + if self.products is None and "products" in self.model_fields_set: + _dict['products'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") if obj.get("type") is not None else 'STATIC', + "name": obj.get("name"), + "products": [ProductCollectionsCreateRequestBodyProductsItem.from_dict(_item) for _item in obj["products"]] if obj.get("products") is not None else None, + "filter": ProductCollectionsCreateRequestBodyFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None + }) + return _obj + + diff --git a/voucherify/models/product_collections_create_request_body_filter.py b/voucherify/models/product_collections_create_request_body_filter.py new file mode 100644 index 00000000..baacb419 --- /dev/null +++ b/voucherify/models/product_collections_create_request_body_filter.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsCreateRequestBodyFilter(BaseModel): + """ + Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + """ # noqa: E501 + junction: Junction + id: Optional[FieldConditions] = None + product_id: Optional[FieldConditions] = None + source_id: Optional[FieldConditions] = None + name: Optional[FieldConditions] = None + price: Optional[FieldConditions] = None + object: Optional[FieldConditions] = None + attributes: Optional[FieldConditions] = None + metadata: Optional[FieldConditions] = None + image_url: Optional[FieldConditions] = None + skus: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + updated_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "id", "product_id", "source_id", "name", "price", "object", "attributes", "metadata", "image_url", "skus", "created_at", "updated_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateRequestBodyFilter 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 id + if self.id: + _dict['id'] = self.id.to_dict() + # override the default output from pydantic by calling `to_dict()` of product_id + if self.product_id: + _dict['product_id'] = self.product_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_id + if self.source_id: + _dict['source_id'] = self.source_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of name + if self.name: + _dict['name'] = self.name.to_dict() + # override the default output from pydantic by calling `to_dict()` of price + if self.price: + _dict['price'] = self.price.to_dict() + # override the default output from pydantic by calling `to_dict()` of object + if self.object: + _dict['object'] = self.object.to_dict() + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of image_url + if self.image_url: + _dict['image_url'] = self.image_url.to_dict() + # override the default output from pydantic by calling `to_dict()` of skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + # override the default output from pydantic by calling `to_dict()` of updated_at + if self.updated_at: + _dict['updated_at'] = self.updated_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateRequestBodyFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "id": FieldConditions.from_dict(obj["id"]) if obj.get("id") is not None else None, + "product_id": FieldConditions.from_dict(obj["product_id"]) if obj.get("product_id") is not None else None, + "source_id": FieldConditions.from_dict(obj["source_id"]) if obj.get("source_id") is not None else None, + "name": FieldConditions.from_dict(obj["name"]) if obj.get("name") is not None else None, + "price": FieldConditions.from_dict(obj["price"]) if obj.get("price") is not None else None, + "object": FieldConditions.from_dict(obj["object"]) if obj.get("object") is not None else None, + "attributes": FieldConditions.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": FieldConditions.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "image_url": FieldConditions.from_dict(obj["image_url"]) if obj.get("image_url") is not None else None, + "skus": FieldConditions.from_dict(obj["skus"]) if obj.get("skus") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None, + "updated_at": FieldConditions.from_dict(obj["updated_at"]) if obj.get("updated_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/product_collections_create_request_body_products_item.py b/voucherify/models/product_collections_create_request_body_products_item.py new file mode 100644 index 00000000..d1df2763 --- /dev/null +++ b/voucherify/models/product_collections_create_request_body_products_item.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ProductCollectionsCreateRequestBodyProductsItem(BaseModel): + """ + ProductCollectionsCreateRequestBodyProductsItem + """ # noqa: E501 + id: StrictStr = Field(description="The product ID.") + product_id: Optional[StrictStr] = Field(default=None, description="Product ID for SKUs.") + object: StrictStr = Field(description="Denotes the type of the object represented by the ID.") + __properties: ClassVar[List[str]] = ["id", "product_id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['sku', 'product']): + raise ValueError("must be one of enum values ('sku', 'product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateRequestBodyProductsItem 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 ProductCollectionsCreateRequestBodyProductsItem 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"), + "product_id": obj.get("product_id"), + "object": obj.get("object") + }) + return _obj + + diff --git a/voucherify/models/product_collections_create_response_body.py b/voucherify/models/product_collections_create_response_body.py new file mode 100644 index 00000000..be3b250c --- /dev/null +++ b/voucherify/models/product_collections_create_response_body.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.product_collections_create_response_body_filter import ProductCollectionsCreateResponseBodyFilter +from voucherify.models.product_collections_create_response_body_products_item import ProductCollectionsCreateResponseBodyProductsItem +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/product-collections`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Product collection ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product collection name.") + type: Optional[StrictStr] = Field(default=None, description="Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).") + filter: Optional[ProductCollectionsCreateResponseBodyFilter] = None + products: Optional[List[ProductCollectionsCreateResponseBodyProductsItem]] = Field(default=None, description="Defines a set of products for a `STATIC` product collection type.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='products_collection', description="The type of the object represented by JSON. This object stores information about the static product collection.") + __properties: ClassVar[List[str]] = ["id", "name", "type", "filter", "products", "created_at", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['STATIC', 'AUTO_UPDATE']): + raise ValueError("must be one of enum values ('STATIC', 'AUTO_UPDATE')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection']): + raise ValueError("must be one of enum values ('products_collection')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateResponseBody 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 filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in products (list) + _items = [] + if self.products: + for _item_products in self.products: + if _item_products: + _items.append(_item_products.to_dict()) + _dict['products'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + # set to None if products (nullable) is None + # and model_fields_set contains the field + if self.products is None and "products" in self.model_fields_set: + _dict['products'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateResponseBody 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"), + "name": obj.get("name"), + "type": obj.get("type"), + "filter": ProductCollectionsCreateResponseBodyFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "products": [ProductCollectionsCreateResponseBodyProductsItem.from_dict(_item) for _item in obj["products"]] if obj.get("products") is not None else None, + "created_at": obj.get("created_at"), + "object": obj.get("object") if obj.get("object") is not None else 'products_collection' + }) + return _obj + + diff --git a/voucherify/models/product_collections_create_response_body_filter.py b/voucherify/models/product_collections_create_response_body_filter.py new file mode 100644 index 00000000..20628fb3 --- /dev/null +++ b/voucherify/models/product_collections_create_response_body_filter.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsCreateResponseBodyFilter(BaseModel): + """ + Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + """ # noqa: E501 + junction: Junction + id: Optional[FieldConditions] = None + product_id: Optional[FieldConditions] = None + source_id: Optional[FieldConditions] = None + name: Optional[FieldConditions] = None + price: Optional[FieldConditions] = None + object: Optional[FieldConditions] = None + attributes: Optional[FieldConditions] = None + metadata: Optional[FieldConditions] = None + image_url: Optional[FieldConditions] = None + skus: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + updated_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "id", "product_id", "source_id", "name", "price", "object", "attributes", "metadata", "image_url", "skus", "created_at", "updated_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateResponseBodyFilter 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 id + if self.id: + _dict['id'] = self.id.to_dict() + # override the default output from pydantic by calling `to_dict()` of product_id + if self.product_id: + _dict['product_id'] = self.product_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_id + if self.source_id: + _dict['source_id'] = self.source_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of name + if self.name: + _dict['name'] = self.name.to_dict() + # override the default output from pydantic by calling `to_dict()` of price + if self.price: + _dict['price'] = self.price.to_dict() + # override the default output from pydantic by calling `to_dict()` of object + if self.object: + _dict['object'] = self.object.to_dict() + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of image_url + if self.image_url: + _dict['image_url'] = self.image_url.to_dict() + # override the default output from pydantic by calling `to_dict()` of skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + # override the default output from pydantic by calling `to_dict()` of updated_at + if self.updated_at: + _dict['updated_at'] = self.updated_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateResponseBodyFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "id": FieldConditions.from_dict(obj["id"]) if obj.get("id") is not None else None, + "product_id": FieldConditions.from_dict(obj["product_id"]) if obj.get("product_id") is not None else None, + "source_id": FieldConditions.from_dict(obj["source_id"]) if obj.get("source_id") is not None else None, + "name": FieldConditions.from_dict(obj["name"]) if obj.get("name") is not None else None, + "price": FieldConditions.from_dict(obj["price"]) if obj.get("price") is not None else None, + "object": FieldConditions.from_dict(obj["object"]) if obj.get("object") is not None else None, + "attributes": FieldConditions.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": FieldConditions.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "image_url": FieldConditions.from_dict(obj["image_url"]) if obj.get("image_url") is not None else None, + "skus": FieldConditions.from_dict(obj["skus"]) if obj.get("skus") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None, + "updated_at": FieldConditions.from_dict(obj["updated_at"]) if obj.get("updated_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/product_collections_create_response_body_products_item.py b/voucherify/models/product_collections_create_response_body_products_item.py new file mode 100644 index 00000000..8f51ce3b --- /dev/null +++ b/voucherify/models/product_collections_create_response_body_products_item.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ProductCollectionsCreateResponseBodyProductsItem(BaseModel): + """ + ProductCollectionsCreateResponseBodyProductsItem + """ # noqa: E501 + id: StrictStr = Field(description="The product ID.") + product_id: Optional[StrictStr] = Field(default=None, description="Product ID for SKUs.") + object: StrictStr = Field(description="Denotes the type of the object represented by the ID.") + __properties: ClassVar[List[str]] = ["id", "product_id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['sku', 'product']): + raise ValueError("must be one of enum values ('sku', 'product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsCreateResponseBodyProductsItem 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 ProductCollectionsCreateResponseBodyProductsItem 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"), + "product_id": obj.get("product_id"), + "object": obj.get("object") + }) + return _obj + + diff --git a/voucherify/models/product_collections_get_response_body.py b/voucherify/models/product_collections_get_response_body.py new file mode 100644 index 00000000..76915901 --- /dev/null +++ b/voucherify/models/product_collections_get_response_body.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.product_collections_get_response_body_filter import ProductCollectionsGetResponseBodyFilter +from voucherify.models.product_collections_get_response_body_products_item import ProductCollectionsGetResponseBodyProductsItem +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/product-collections/{productCollectionId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Product collection ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product collection name.") + type: Optional[StrictStr] = Field(default=None, description="Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).") + filter: Optional[ProductCollectionsGetResponseBodyFilter] = None + products: Optional[List[ProductCollectionsGetResponseBodyProductsItem]] = Field(default=None, description="Defines a set of products for a `STATIC` product collection type.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='products_collection', description="The type of the object represented by JSON. This object stores information about the static product collection.") + __properties: ClassVar[List[str]] = ["id", "name", "type", "filter", "products", "created_at", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['STATIC', 'AUTO_UPDATE']): + raise ValueError("must be one of enum values ('STATIC', 'AUTO_UPDATE')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection']): + raise ValueError("must be one of enum values ('products_collection')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsGetResponseBody 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 filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in products (list) + _items = [] + if self.products: + for _item_products in self.products: + if _item_products: + _items.append(_item_products.to_dict()) + _dict['products'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + # set to None if products (nullable) is None + # and model_fields_set contains the field + if self.products is None and "products" in self.model_fields_set: + _dict['products'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsGetResponseBody 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"), + "name": obj.get("name"), + "type": obj.get("type"), + "filter": ProductCollectionsGetResponseBodyFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "products": [ProductCollectionsGetResponseBodyProductsItem.from_dict(_item) for _item in obj["products"]] if obj.get("products") is not None else None, + "created_at": obj.get("created_at"), + "object": obj.get("object") if obj.get("object") is not None else 'products_collection' + }) + return _obj + + diff --git a/voucherify/models/product_collections_get_response_body_filter.py b/voucherify/models/product_collections_get_response_body_filter.py new file mode 100644 index 00000000..29c2e3a4 --- /dev/null +++ b/voucherify/models/product_collections_get_response_body_filter.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsGetResponseBodyFilter(BaseModel): + """ + Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + """ # noqa: E501 + junction: Junction + id: Optional[FieldConditions] = None + product_id: Optional[FieldConditions] = None + source_id: Optional[FieldConditions] = None + name: Optional[FieldConditions] = None + price: Optional[FieldConditions] = None + object: Optional[FieldConditions] = None + attributes: Optional[FieldConditions] = None + metadata: Optional[FieldConditions] = None + image_url: Optional[FieldConditions] = None + skus: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + updated_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "id", "product_id", "source_id", "name", "price", "object", "attributes", "metadata", "image_url", "skus", "created_at", "updated_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsGetResponseBodyFilter 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 id + if self.id: + _dict['id'] = self.id.to_dict() + # override the default output from pydantic by calling `to_dict()` of product_id + if self.product_id: + _dict['product_id'] = self.product_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_id + if self.source_id: + _dict['source_id'] = self.source_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of name + if self.name: + _dict['name'] = self.name.to_dict() + # override the default output from pydantic by calling `to_dict()` of price + if self.price: + _dict['price'] = self.price.to_dict() + # override the default output from pydantic by calling `to_dict()` of object + if self.object: + _dict['object'] = self.object.to_dict() + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of image_url + if self.image_url: + _dict['image_url'] = self.image_url.to_dict() + # override the default output from pydantic by calling `to_dict()` of skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + # override the default output from pydantic by calling `to_dict()` of updated_at + if self.updated_at: + _dict['updated_at'] = self.updated_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsGetResponseBodyFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "id": FieldConditions.from_dict(obj["id"]) if obj.get("id") is not None else None, + "product_id": FieldConditions.from_dict(obj["product_id"]) if obj.get("product_id") is not None else None, + "source_id": FieldConditions.from_dict(obj["source_id"]) if obj.get("source_id") is not None else None, + "name": FieldConditions.from_dict(obj["name"]) if obj.get("name") is not None else None, + "price": FieldConditions.from_dict(obj["price"]) if obj.get("price") is not None else None, + "object": FieldConditions.from_dict(obj["object"]) if obj.get("object") is not None else None, + "attributes": FieldConditions.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": FieldConditions.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "image_url": FieldConditions.from_dict(obj["image_url"]) if obj.get("image_url") is not None else None, + "skus": FieldConditions.from_dict(obj["skus"]) if obj.get("skus") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None, + "updated_at": FieldConditions.from_dict(obj["updated_at"]) if obj.get("updated_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/product_collections_get_response_body_products_item.py b/voucherify/models/product_collections_get_response_body_products_item.py new file mode 100644 index 00000000..ef537326 --- /dev/null +++ b/voucherify/models/product_collections_get_response_body_products_item.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ProductCollectionsGetResponseBodyProductsItem(BaseModel): + """ + ProductCollectionsGetResponseBodyProductsItem + """ # noqa: E501 + id: StrictStr = Field(description="The product ID.") + product_id: Optional[StrictStr] = Field(default=None, description="Product ID for SKUs.") + object: StrictStr = Field(description="Denotes the type of the object represented by the ID.") + __properties: ClassVar[List[str]] = ["id", "product_id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['sku', 'product']): + raise ValueError("must be one of enum values ('sku', 'product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsGetResponseBodyProductsItem 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 ProductCollectionsGetResponseBodyProductsItem 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"), + "product_id": obj.get("product_id"), + "object": obj.get("object") + }) + return _obj + + diff --git a/voucherify/models/product_collections_item.py b/voucherify/models/product_collections_item.py new file mode 100644 index 00000000..03962268 --- /dev/null +++ b/voucherify/models/product_collections_item.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.product_collections_item_filter import ProductCollectionsItemFilter +from voucherify.models.product_collections_item_products_item import ProductCollectionsItemProductsItem +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsItem(BaseModel): + """ + This is an object representing a product collection base. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Product collection ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product collection name.") + type: Optional[StrictStr] = Field(default=None, description="Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).") + filter: Optional[ProductCollectionsItemFilter] = None + products: Optional[List[ProductCollectionsItemProductsItem]] = Field(default=None, description="Defines a set of products for a `STATIC` product collection type.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='products_collection', description="The type of the object represented by JSON. This object stores information about the static product collection.") + __properties: ClassVar[List[str]] = ["id", "name", "type", "filter", "products", "created_at", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['STATIC', 'AUTO_UPDATE']): + raise ValueError("must be one of enum values ('STATIC', 'AUTO_UPDATE')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['products_collection']): + raise ValueError("must be one of enum values ('products_collection')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsItem 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 filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in products (list) + _items = [] + if self.products: + for _item_products in self.products: + if _item_products: + _items.append(_item_products.to_dict()) + _dict['products'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + # set to None if products (nullable) is None + # and model_fields_set contains the field + if self.products is None and "products" in self.model_fields_set: + _dict['products'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsItem 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"), + "name": obj.get("name"), + "type": obj.get("type"), + "filter": ProductCollectionsItemFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "products": [ProductCollectionsItemProductsItem.from_dict(_item) for _item in obj["products"]] if obj.get("products") is not None else None, + "created_at": obj.get("created_at"), + "object": obj.get("object") if obj.get("object") is not None else 'products_collection' + }) + return _obj + + diff --git a/voucherify/models/product_collections_item_filter.py b/voucherify/models/product_collections_item_filter.py new file mode 100644 index 00000000..83a229f8 --- /dev/null +++ b/voucherify/models/product_collections_item_filter.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.field_conditions import FieldConditions +from voucherify.models.junction import Junction +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsItemFilter(BaseModel): + """ + Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type. + """ # noqa: E501 + junction: Junction + id: Optional[FieldConditions] = None + product_id: Optional[FieldConditions] = None + source_id: Optional[FieldConditions] = None + name: Optional[FieldConditions] = None + price: Optional[FieldConditions] = None + object: Optional[FieldConditions] = None + attributes: Optional[FieldConditions] = None + metadata: Optional[FieldConditions] = None + image_url: Optional[FieldConditions] = None + skus: Optional[FieldConditions] = None + created_at: Optional[FieldConditions] = None + updated_at: Optional[FieldConditions] = None + __properties: ClassVar[List[str]] = ["junction", "id", "product_id", "source_id", "name", "price", "object", "attributes", "metadata", "image_url", "skus", "created_at", "updated_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsItemFilter 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 id + if self.id: + _dict['id'] = self.id.to_dict() + # override the default output from pydantic by calling `to_dict()` of product_id + if self.product_id: + _dict['product_id'] = self.product_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_id + if self.source_id: + _dict['source_id'] = self.source_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of name + if self.name: + _dict['name'] = self.name.to_dict() + # override the default output from pydantic by calling `to_dict()` of price + if self.price: + _dict['price'] = self.price.to_dict() + # override the default output from pydantic by calling `to_dict()` of object + if self.object: + _dict['object'] = self.object.to_dict() + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of image_url + if self.image_url: + _dict['image_url'] = self.image_url.to_dict() + # override the default output from pydantic by calling `to_dict()` of skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_at + if self.created_at: + _dict['created_at'] = self.created_at.to_dict() + # override the default output from pydantic by calling `to_dict()` of updated_at + if self.updated_at: + _dict['updated_at'] = self.updated_at.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsItemFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "id": FieldConditions.from_dict(obj["id"]) if obj.get("id") is not None else None, + "product_id": FieldConditions.from_dict(obj["product_id"]) if obj.get("product_id") is not None else None, + "source_id": FieldConditions.from_dict(obj["source_id"]) if obj.get("source_id") is not None else None, + "name": FieldConditions.from_dict(obj["name"]) if obj.get("name") is not None else None, + "price": FieldConditions.from_dict(obj["price"]) if obj.get("price") is not None else None, + "object": FieldConditions.from_dict(obj["object"]) if obj.get("object") is not None else None, + "attributes": FieldConditions.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": FieldConditions.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "image_url": FieldConditions.from_dict(obj["image_url"]) if obj.get("image_url") is not None else None, + "skus": FieldConditions.from_dict(obj["skus"]) if obj.get("skus") is not None else None, + "created_at": FieldConditions.from_dict(obj["created_at"]) if obj.get("created_at") is not None else None, + "updated_at": FieldConditions.from_dict(obj["updated_at"]) if obj.get("updated_at") is not None else None + }) + return _obj + + diff --git a/voucherify/models/product_collections_item_products_item.py b/voucherify/models/product_collections_item_products_item.py new file mode 100644 index 00000000..e4eea602 --- /dev/null +++ b/voucherify/models/product_collections_item_products_item.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ProductCollectionsItemProductsItem(BaseModel): + """ + ProductCollectionsItemProductsItem + """ # noqa: E501 + id: StrictStr = Field(description="The product ID.") + product_id: Optional[StrictStr] = Field(default=None, description="Product ID for SKUs.") + object: StrictStr = Field(description="Denotes the type of the object represented by the ID.") + __properties: ClassVar[List[str]] = ["id", "product_id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['sku', 'product']): + raise ValueError("must be one of enum values ('sku', 'product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsItemProductsItem 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 ProductCollectionsItemProductsItem 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"), + "product_id": obj.get("product_id"), + "object": obj.get("object") + }) + return _obj + + diff --git a/voucherify/models/product_collections_list_response_body.py b/voucherify/models/product_collections_list_response_body.py new file mode 100644 index 00000000..ee054364 --- /dev/null +++ b/voucherify/models/product_collections_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.product_collections_item import ProductCollectionsItem +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/product-collections`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about product collections.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of product collections.") + data: Optional[List[ProductCollectionsItem]] = Field(default=None, description="A dictionary that contains an array of product collections and their details.") + total: Optional[StrictInt] = Field(default=None, description="Total number of product collections.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [ProductCollectionsItem.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/product_collections_products_list_response_body.py b/voucherify/models/product_collections_products_list_response_body.py new file mode 100644 index 00000000..041be644 --- /dev/null +++ b/voucherify/models/product_collections_products_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.product_collections_products_list_response_body_data_item import ProductCollectionsProductsListResponseBodyDataItem +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsProductsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/product-collections/{productCollectionId}/products`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about products and SKUs.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of products and SKUs.") + data: Optional[List[ProductCollectionsProductsListResponseBodyDataItem]] = None + total: Optional[StrictInt] = Field(default=None, description="Total number of products & SKUs in the product collection.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsProductsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsProductsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [ProductCollectionsProductsListResponseBodyDataItem.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/product_collections_products_list_response_body_data_item.py b/voucherify/models/product_collections_products_list_response_body_data_item.py new file mode 100644 index 00000000..2bc287a4 --- /dev/null +++ b/voucherify/models/product_collections_products_list_response_body_data_item.py @@ -0,0 +1,158 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.product_without_skus import ProductWithoutSkus +from typing import Optional, Set +from typing_extensions import Self + +class ProductCollectionsProductsListResponseBodyDataItem(BaseModel): + """ + ProductCollectionsProductsListResponseBodyDataItem + """ # noqa: E501 + id: Optional[StrictStr] = None + source_id: Optional[StrictStr] = None + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = None + image_url: Optional[StrictStr] = None + created_at: Optional[StrictStr] = None + updated_at: Optional[StrictStr] = None + object: Optional[StrictStr] = None + product_id: Optional[StrictStr] = Field(default=None, description="The parent product's unique ID.") + sku: Optional[StrictStr] = Field(default=None, description="Unique user-defined SKU name.") + currency: Optional[StrictStr] = Field(default=None, description="SKU price currency.") + product: Optional[ProductWithoutSkus] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "price", "attributes", "metadata", "image_url", "created_at", "updated_at", "object", "product_id", "sku", "currency", "product"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product', 'sku']): + raise ValueError("must be one of enum values ('product', 'sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductCollectionsProductsListResponseBodyDataItem 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 product + if self.product: + _dict['product'] = self.product.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductCollectionsProductsListResponseBodyDataItem 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object"), + "product_id": obj.get("product_id"), + "sku": obj.get("sku"), + "currency": obj.get("currency"), + "product": ProductWithoutSkus.from_dict(obj["product"]) if obj.get("product") is not None else None + }) + return _obj + + diff --git a/voucherify/models/product_without_skus.py b/voucherify/models/product_without_skus.py new file mode 100644 index 00000000..8bab2297 --- /dev/null +++ b/voucherify/models/product_without_skus.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ProductWithoutSkus(BaseModel): + """ + ProductWithoutSkus + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique product source ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='product', description="The type of the object represented by JSON. This object stores information about the product.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "price", "attributes", "metadata", "image_url", "created_at", "updated_at", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product']): + raise ValueError("must be one of enum values ('product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductWithoutSkus 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductWithoutSkus 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'product' + }) + return _obj + + diff --git a/voucherify/models/products_create_request_body.py b/voucherify/models/products_create_request_body.py new file mode 100644 index 00000000..4bdd7d17 --- /dev/null +++ b/voucherify/models/products_create_request_body.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsCreateRequestBody(BaseModel): + """ + Request schema for **POST** `v1/products`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the product and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique product source ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "price", "attributes", "metadata", "image_url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsCreateRequestBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsCreateRequestBody 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url") + }) + return _obj + + diff --git a/voucherify/models/products_create_response_body.py b/voucherify/models/products_create_response_body.py new file mode 100644 index 00000000..13c7d25f --- /dev/null +++ b/voucherify/models/products_create_response_body.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.skus_list_for_product import SkusListForProduct +from typing import Optional, Set +from typing_extensions import Self + +class ProductsCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/products`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique product source ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='product', description="The type of the object represented by JSON. This object stores information about the product.") + skus: Optional[SkusListForProduct] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "price", "attributes", "metadata", "image_url", "created_at", "updated_at", "object", "skus"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product']): + raise ValueError("must be one of enum values ('product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsCreateResponseBody 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 skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsCreateResponseBody 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'product', + "skus": SkusListForProduct.from_dict(obj["skus"]) if obj.get("skus") is not None else None + }) + return _obj + + diff --git a/voucherify/models/products_get_response_body.py b/voucherify/models/products_get_response_body.py new file mode 100644 index 00000000..fdd67d4e --- /dev/null +++ b/voucherify/models/products_get_response_body.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.skus_list_for_product import SkusListForProduct +from typing import Optional, Set +from typing_extensions import Self + +class ProductsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/products/{productId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique product source ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='product', description="The type of the object represented by JSON. This object stores information about the product.") + skus: Optional[SkusListForProduct] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "price", "attributes", "metadata", "image_url", "created_at", "updated_at", "object", "skus"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product']): + raise ValueError("must be one of enum values ('product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsGetResponseBody 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 skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsGetResponseBody 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'product', + "skus": SkusListForProduct.from_dict(obj["skus"]) if obj.get("skus") is not None else None + }) + return _obj + + diff --git a/voucherify/models/products_import_csv_create_response_body.py b/voucherify/models/products_import_csv_create_response_body.py new file mode 100644 index 00000000..41bb8b35 --- /dev/null +++ b/voucherify/models/products_import_csv_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsImportCsvCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/products/importCSV`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsImportCsvCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsImportCsvCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/products_list_response_body.py b/voucherify/models/products_list_response_body.py new file mode 100644 index 00000000..ffb815a8 --- /dev/null +++ b/voucherify/models/products_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.product import Product +from typing import Optional, Set +from typing_extensions import Self + +class ProductsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/products`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about products in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='products', description="Identifies the name of the attribute that contains the array of product objects.") + products: Optional[List[Product]] = Field(default=None, description="Contains array of product objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of product objects.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "products", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsListResponseBody 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 products (list) + _items = [] + if self.products: + for _item_products in self.products: + if _item_products: + _items.append(_item_products.to_dict()) + _dict['products'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if products (nullable) is None + # and model_fields_set contains the field + if self.products is None and "products" in self.model_fields_set: + _dict['products'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'products', + "products": [Product.from_dict(_item) for _item in obj["products"]] if obj.get("products") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/products_metadata_update_in_bulk_request_body.py b/voucherify/models/products_metadata_update_in_bulk_request_body.py new file mode 100644 index 00000000..93376f8e --- /dev/null +++ b/voucherify/models/products_metadata_update_in_bulk_request_body.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsMetadataUpdateInBulkRequestBody(BaseModel): + """ + Request schema for **POST** `v1/products/metadata/async`. + """ # noqa: E501 + source_ids: Optional[List[StrictStr]] = Field(default=None, description="Array of unique product source IDs.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + __properties: ClassVar[List[str]] = ["source_ids", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsMetadataUpdateInBulkRequestBody 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, + ) + # set to None if source_ids (nullable) is None + # and model_fields_set contains the field + if self.source_ids is None and "source_ids" in self.model_fields_set: + _dict['source_ids'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsMetadataUpdateInBulkRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source_ids": obj.get("source_ids"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/products_metadata_update_in_bulk_response_body.py b/voucherify/models/products_metadata_update_in_bulk_response_body.py new file mode 100644 index 00000000..51e88703 --- /dev/null +++ b/voucherify/models/products_metadata_update_in_bulk_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsMetadataUpdateInBulkResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/products/metadata/async`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsMetadataUpdateInBulkResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsMetadataUpdateInBulkResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/products_skus_create_request_body.py b/voucherify/models/products_skus_create_request_body.py new file mode 100644 index 00000000..2f44bb16 --- /dev/null +++ b/voucherify/models/products_skus_create_request_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsSkusCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/products/{productId}/skus + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique SKU ID.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique SKU identifier from your inventory system.") + sku: Optional[StrictStr] = Field(default=None, description="Unique user-defined SKU name.") + price: Optional[StrictInt] = Field(default=None, description="SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + currency: Optional[StrictStr] = Field(default=None, description="SKU price currency.") + attributes: Optional[Dict[str, Any]] = Field(default=None, description="The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format.") + __properties: ClassVar[List[str]] = ["id", "source_id", "sku", "price", "currency", "attributes", "image_url", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsSkusCreateRequestBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsSkusCreateRequestBody 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"), + "source_id": obj.get("source_id"), + "sku": obj.get("sku"), + "price": obj.get("price"), + "currency": obj.get("currency"), + "attributes": obj.get("attributes"), + "image_url": obj.get("image_url"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/products_skus_create_response_body.py b/voucherify/models/products_skus_create_response_body.py new file mode 100644 index 00000000..a2ab863e --- /dev/null +++ b/voucherify/models/products_skus_create_response_body.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ProductsSkusCreateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/products/{productId}/skus`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the SKU and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique SKU identifier from your inventory system.") + product_id: Optional[StrictStr] = Field(default=None, description="The parent product's unique ID.") + sku: Optional[StrictStr] = Field(default=None, description="Unique user-defined SKU name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + currency: Optional[StrictStr] = Field(default=None, description="SKU price currency.") + attributes: Optional[Dict[str, Any]] = Field(default=None, description="The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='sku', description="The type of the object represented by JSON. This object stores information about the `SKU`.") + __properties: ClassVar[List[str]] = ["id", "source_id", "product_id", "sku", "price", "currency", "attributes", "image_url", "metadata", "created_at", "updated_at", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['sku']): + raise ValueError("must be one of enum values ('sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsSkusCreateResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsSkusCreateResponseBody 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"), + "source_id": obj.get("source_id"), + "product_id": obj.get("product_id"), + "sku": obj.get("sku"), + "price": obj.get("price"), + "currency": obj.get("currency"), + "attributes": obj.get("attributes"), + "image_url": obj.get("image_url"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'sku' + }) + return _obj + + diff --git a/voucherify/models/products_skus_list_response_body.py b/voucherify/models/products_skus_list_response_body.py new file mode 100644 index 00000000..965873bc --- /dev/null +++ b/voucherify/models/products_skus_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.sku import Sku +from typing import Optional, Set +from typing_extensions import Self + +class ProductsSkusListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/products/{productId}/skus`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about SKUs.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of SKUs.") + skus: Optional[List[Sku]] = Field(default=None, description="A dictionary that contains an array of SKUs.") + total: Optional[StrictInt] = Field(default=None, description="Total number of SKUs in the product.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "skus", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsSkusListResponseBody 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 skus (list) + _items = [] + if self.skus: + for _item_skus in self.skus: + if _item_skus: + _items.append(_item_skus.to_dict()) + _dict['skus'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if skus (nullable) is None + # and model_fields_set contains the field + if self.skus is None and "skus" in self.model_fields_set: + _dict['skus'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsSkusListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "skus": [Sku.from_dict(_item) for _item in obj["skus"]] if obj.get("skus") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/products_skus_update_request_body.py b/voucherify/models/products_skus_update_request_body.py new file mode 100644 index 00000000..1dadb629 --- /dev/null +++ b/voucherify/models/products_skus_update_request_body.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsSkusUpdateRequestBody(BaseModel): + """ + Request body schema for **PUT** `v1/products/{productId}/skus/{skuId}`. + """ # noqa: E501 + sku: Optional[StrictStr] = Field(default=None, description="Unique user-defined SKU name.") + price: Optional[StrictInt] = Field(default=None, description="SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + currency: Optional[StrictStr] = Field(default=None, description="SKU price currency.") + attributes: Optional[Dict[str, Any]] = Field(default=None, description="The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format.") + __properties: ClassVar[List[str]] = ["sku", "price", "currency", "attributes", "image_url", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsSkusUpdateRequestBody 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, + ) + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsSkusUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sku": obj.get("sku"), + "price": obj.get("price"), + "currency": obj.get("currency"), + "attributes": obj.get("attributes"), + "image_url": obj.get("image_url"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/products_skus_update_response_body.py b/voucherify/models/products_skus_update_response_body.py new file mode 100644 index 00000000..81a20a53 --- /dev/null +++ b/voucherify/models/products_skus_update_response_body.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ProductsSkusUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/products/{productId}/skus/{skuId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the SKU and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique SKU identifier from your inventory system.") + product_id: Optional[StrictStr] = Field(default=None, description="The parent product's unique ID.") + sku: Optional[StrictStr] = Field(default=None, description="Unique user-defined SKU name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + currency: Optional[StrictStr] = Field(default=None, description="SKU price currency.") + attributes: Optional[Dict[str, Any]] = Field(default=None, description="The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='sku', description="The type of the object represented by JSON. This object stores information about the `SKU`.") + __properties: ClassVar[List[str]] = ["id", "source_id", "product_id", "sku", "price", "currency", "attributes", "image_url", "metadata", "created_at", "updated_at", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['sku']): + raise ValueError("must be one of enum values ('sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsSkusUpdateResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsSkusUpdateResponseBody 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"), + "source_id": obj.get("source_id"), + "product_id": obj.get("product_id"), + "sku": obj.get("sku"), + "price": obj.get("price"), + "currency": obj.get("currency"), + "attributes": obj.get("attributes"), + "image_url": obj.get("image_url"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'sku' + }) + return _obj + + diff --git a/voucherify/models/products_update_in_bulk_request_body.py b/voucherify/models/products_update_in_bulk_request_body.py new file mode 100644 index 00000000..fd15e272 --- /dev/null +++ b/voucherify/models/products_update_in_bulk_request_body.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsUpdateInBulkRequestBody(BaseModel): + """ + Request schema for **POST** `v1/products/bulk/async`. + """ # noqa: E501 + source_id: Optional[StrictStr] = Field(default=None, description="Unique product source ID from your inventory system.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + __properties: ClassVar[List[str]] = ["source_id", "name", "price", "attributes", "image_url", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsUpdateInBulkRequestBody 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, + ) + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsUpdateInBulkRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "image_url": obj.get("image_url"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/products_update_in_bulk_response_body.py b/voucherify/models/products_update_in_bulk_response_body.py new file mode 100644 index 00000000..05c378e7 --- /dev/null +++ b/voucherify/models/products_update_in_bulk_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsUpdateInBulkResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/products/bulk/async`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsUpdateInBulkResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsUpdateInBulkResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/products_update_request_body.py b/voucherify/models/products_update_request_body.py new file mode 100644 index 00000000..234c8318 --- /dev/null +++ b/voucherify/models/products_update_request_body.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ProductsUpdateRequestBody(BaseModel): + """ + Request schema for **PUT** `v1/products`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + __properties: ClassVar[List[str]] = ["name", "price", "attributes", "metadata", "image_url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsUpdateRequestBody 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, + ) + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsUpdateRequestBody 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"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url") + }) + return _obj + + diff --git a/voucherify/models/products_update_response_body.py b/voucherify/models/products_update_response_body.py new file mode 100644 index 00000000..0e3bb7f7 --- /dev/null +++ b/voucherify/models/products_update_response_body.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.skus_list_for_product import SkusListForProduct +from typing import Optional, Set +from typing_extensions import Self + +class ProductsUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/products/{productId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique product source ID.") + name: Optional[StrictStr] = Field(default=None, description="Unique user-defined product name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + attributes: Optional[List[StrictStr]] = Field(default=None, description="A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the product was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='product', description="The type of the object represented by JSON. This object stores information about the product.") + skus: Optional[SkusListForProduct] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "price", "attributes", "metadata", "image_url", "created_at", "updated_at", "object", "skus"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['product']): + raise ValueError("must be one of enum values ('product')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductsUpdateResponseBody 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 skus + if self.skus: + _dict['skus'] = self.skus.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductsUpdateResponseBody 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "price": obj.get("price"), + "attributes": obj.get("attributes"), + "metadata": obj.get("metadata"), + "image_url": obj.get("image_url"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'product', + "skus": SkusListForProduct.from_dict(obj["skus"]) if obj.get("skus") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotion_stack.py b/voucherify/models/promotion_stack.py new file mode 100644 index 00000000..497327d6 --- /dev/null +++ b/voucherify/models/promotion_stack.py @@ -0,0 +1,172 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotion_stack_tiers import PromotionStackTiers +from typing import Optional, Set +from typing_extensions import Self + +class PromotionStack(BaseModel): + """ + PromotionStack + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Promotion stack name.") + tiers: Optional[PromotionStackTiers] = None + id: Optional[StrictStr] = Field(default=None, description="Unique promotion stack ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion stack's parent campaign's unique ID.") + object: Optional[StrictStr] = Field(default='promotion_stack', description="The type of the object represented by JSON. ") + category_id: Optional[StrictStr] = Field(default=None, description="Promotion stack category ID.") + categories: Optional[List[Category]] = Field(default=None, description="Details about the category assigned to the promotion stack.") + __properties: ClassVar[List[str]] = ["name", "tiers", "id", "created_at", "updated_at", "campaign_id", "object", "category_id", "categories"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['promotion_stack']): + raise ValueError("must be one of enum values ('promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionStack 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 tiers + if self.tiers: + _dict['tiers'] = self.tiers.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionStack 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"), + "tiers": PromotionStackTiers.from_dict(obj["tiers"]) if obj.get("tiers") is not None else None, + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "campaign_id": obj.get("campaign_id"), + "object": obj.get("object") if obj.get("object") is not None else 'promotion_stack', + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotion_stack_base.py b/voucherify/models/promotion_stack_base.py new file mode 100644 index 00000000..26aa9b16 --- /dev/null +++ b/voucherify/models/promotion_stack_base.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_stack_base_tiers import PromotionStackBaseTiers +from typing import Optional, Set +from typing_extensions import Self + +class PromotionStackBase(BaseModel): + """ + PromotionStackBase + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Promotion stack name.") + tiers: Optional[PromotionStackBaseTiers] = None + __properties: ClassVar[List[str]] = ["name", "tiers"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionStackBase 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 tiers + if self.tiers: + _dict['tiers'] = self.tiers.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionStackBase 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"), + "tiers": PromotionStackBaseTiers.from_dict(obj["tiers"]) if obj.get("tiers") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotion_stack_base_tiers.py b/voucherify/models/promotion_stack_base_tiers.py new file mode 100644 index 00000000..c58d73d2 --- /dev/null +++ b/voucherify/models/promotion_stack_base_tiers.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class PromotionStackBaseTiers(BaseModel): + """ + Contains the tier configuration. A promotion stack can include up to 30 tiers. + """ # noqa: E501 + ids: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, description="Contains the list of tiers in a pre-defined sequence.") + hierarchy_mode: Optional[StrictStr] = 'MANUAL' + __properties: ClassVar[List[str]] = ["ids", "hierarchy_mode"] + + @field_validator('hierarchy_mode') + def hierarchy_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionStackBaseTiers 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, + ) + # set to None if ids (nullable) is None + # and model_fields_set contains the field + if self.ids is None and "ids" in self.model_fields_set: + _dict['ids'] = None + + # set to None if hierarchy_mode (nullable) is None + # and model_fields_set contains the field + if self.hierarchy_mode is None and "hierarchy_mode" in self.model_fields_set: + _dict['hierarchy_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionStackBaseTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "hierarchy_mode": obj.get("hierarchy_mode") if obj.get("hierarchy_mode") is not None else 'MANUAL' + }) + return _obj + + diff --git a/voucherify/models/promotion_stack_tiers.py b/voucherify/models/promotion_stack_tiers.py new file mode 100644 index 00000000..0180b93f --- /dev/null +++ b/voucherify/models/promotion_stack_tiers.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class PromotionStackTiers(BaseModel): + """ + Contains the tier configuration. A promotion stack can include up to 30 tiers. + """ # noqa: E501 + ids: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, description="Contains the list of tiers in a pre-defined sequence.") + hierarchy_mode: Optional[StrictStr] = 'MANUAL' + __properties: ClassVar[List[str]] = ["ids", "hierarchy_mode"] + + @field_validator('hierarchy_mode') + def hierarchy_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionStackTiers 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, + ) + # set to None if ids (nullable) is None + # and model_fields_set contains the field + if self.ids is None and "ids" in self.model_fields_set: + _dict['ids'] = None + + # set to None if hierarchy_mode (nullable) is None + # and model_fields_set contains the field + if self.hierarchy_mode is None and "hierarchy_mode" in self.model_fields_set: + _dict['hierarchy_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionStackTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "hierarchy_mode": obj.get("hierarchy_mode") if obj.get("hierarchy_mode") is not None else 'MANUAL' + }) + return _obj + + diff --git a/voucherify/models/promotion_tier.py b/voucherify/models/promotion_tier.py new file mode 100644 index 00000000..9a3025b2 --- /dev/null +++ b/voucherify/models/promotion_tier.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotion_tier_action import PromotionTierAction +from voucherify.models.promotion_tier_campaign import PromotionTierCampaign +from voucherify.models.promotion_tier_summary import PromotionTierSummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTier(BaseModel): + """ + This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionTierAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[PromotionTierCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[PromotionTierSummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTier 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTier 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": PromotionTierAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": PromotionTierCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": PromotionTierSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotion_tier_action.py b/voucherify/models/promotion_tier_action.py new file mode 100644 index 00000000..021c9c6f --- /dev/null +++ b/voucherify/models/promotion_tier_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTierAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTierAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTierAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotion_tier_campaign.py b/voucherify/models/promotion_tier_campaign.py new file mode 100644 index 00000000..6e2301d9 --- /dev/null +++ b/voucherify/models/promotion_tier_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTierCampaign(BaseModel): + """ + Contains details about promotion tier's parent campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTierCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTierCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/promotion_tier_create_params.py b/voucherify/models/promotion_tier_create_params.py new file mode 100644 index 00000000..50c4b80f --- /dev/null +++ b/voucherify/models/promotion_tier_create_params.py @@ -0,0 +1,193 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_tier_create_params_action import PromotionTierCreateParamsAction +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTierCreateParams(BaseModel): + """ + This is an object representing a promotion tier create params. Promotion tiers are always assigned to a campaign and cannot be used standalone. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionTierCreateParamsAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + validation_rules: Optional[List[StrictStr]] = Field(default=None, description="Array containing the ID of the validation rule associated with the promotion tier.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + category: Optional[StrictStr] = Field(default=None, description="Assign category to the promotion tier.") + category_id: Optional[StrictStr] = Field(default=None, description="Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.") + __properties: ClassVar[List[str]] = ["name", "banner", "action", "metadata", "validation_rules", "active", "hierarchy", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "category", "category_id"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTierCreateParams 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if validation_rules (nullable) is None + # and model_fields_set contains the field + if self.validation_rules is None and "validation_rules" in self.model_fields_set: + _dict['validation_rules'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTierCreateParams 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"), + "banner": obj.get("banner"), + "action": PromotionTierCreateParamsAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "validation_rules": obj.get("validation_rules"), + "active": obj.get("active"), + "hierarchy": obj.get("hierarchy"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "category": obj.get("category"), + "category_id": obj.get("category_id") + }) + return _obj + + diff --git a/voucherify/models/promotion_tier_create_params_action.py b/voucherify/models/promotion_tier_create_params_action.py new file mode 100644 index 00000000..9874c9db --- /dev/null +++ b/voucherify/models/promotion_tier_create_params_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTierCreateParamsAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTierCreateParamsAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTierCreateParamsAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotion_tier_summary.py b/voucherify/models/promotion_tier_summary.py new file mode 100644 index 00000000..3dd3913f --- /dev/null +++ b/voucherify/models/promotion_tier_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_tier_summary_orders import PromotionTierSummaryOrders +from voucherify.models.promotion_tier_summary_redemptions import PromotionTierSummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTierSummary(BaseModel): + """ + Contains statistics about promotion tier redemptions and orders. + """ # noqa: E501 + redemptions: Optional[PromotionTierSummaryRedemptions] = None + orders: Optional[PromotionTierSummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTierSummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTierSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": PromotionTierSummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": PromotionTierSummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotion_tier_summary_orders.py b/voucherify/models/promotion_tier_summary_orders.py new file mode 100644 index 00000000..027c8174 --- /dev/null +++ b/voucherify/models/promotion_tier_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTierSummaryOrders(BaseModel): + """ + Contains statistics about orders related to the promotion tier. + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTierSummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTierSummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/promotion_tier_summary_redemptions.py b/voucherify/models/promotion_tier_summary_redemptions.py new file mode 100644 index 00000000..f71f456d --- /dev/null +++ b/voucherify/models/promotion_tier_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTierSummaryRedemptions(BaseModel): + """ + Contains statistics about promotion tier redemptions. + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTierSummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTierSummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/promotion_tiers_list.py b/voucherify/models/promotion_tiers_list.py new file mode 100644 index 00000000..014f8134 --- /dev/null +++ b/voucherify/models/promotion_tiers_list.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_tier import PromotionTier +from typing import Optional, Set +from typing_extensions import Self + +class PromotionTiersList(BaseModel): + """ + Promotion Tiers + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='tiers', description="Identifies the name of the attribute that contains the array of promotion tier objects.") + tiers: Optional[List[PromotionTier]] = Field(default=None, description="Contains array of promotion tier objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of promotion tiers.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "tiers", "total", "has_more"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionTiersList 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 tiers (list) + _items = [] + if self.tiers: + for _item_tiers in self.tiers: + if _item_tiers: + _items.append(_item_tiers.to_dict()) + _dict['tiers'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionTiersList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'tiers', + "tiers": [PromotionTier.from_dict(_item) for _item in obj["tiers"]] if obj.get("tiers") is not None else None, + "total": obj.get("total"), + "has_more": obj.get("has_more") + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_create_request_body.py b/voucherify/models/promotions_stacks_create_request_body.py new file mode 100644 index 00000000..49ce6414 --- /dev/null +++ b/voucherify/models/promotions_stacks_create_request_body.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_stacks_create_request_body_tiers import PromotionsStacksCreateRequestBodyTiers +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/promotions/{campaignId}/stacks`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Promotion stack name.") + tiers: Optional[PromotionsStacksCreateRequestBodyTiers] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion stack category ID.") + __properties: ClassVar[List[str]] = ["name", "tiers", "category_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateRequestBody 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 tiers + if self.tiers: + _dict['tiers'] = self.tiers.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateRequestBody 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"), + "tiers": PromotionsStacksCreateRequestBodyTiers.from_dict(obj["tiers"]) if obj.get("tiers") is not None else None, + "category_id": obj.get("category_id") + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_create_request_body_tiers.py b/voucherify/models/promotions_stacks_create_request_body_tiers.py new file mode 100644 index 00000000..5c65c513 --- /dev/null +++ b/voucherify/models/promotions_stacks_create_request_body_tiers.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksCreateRequestBodyTiers(BaseModel): + """ + Contains the tier configuration. A promotion stack can include up to 30 tiers. + """ # noqa: E501 + ids: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, description="Contains the list of tiers in a pre-defined sequence.") + hierarchy_mode: Optional[StrictStr] = 'MANUAL' + __properties: ClassVar[List[str]] = ["ids", "hierarchy_mode"] + + @field_validator('hierarchy_mode') + def hierarchy_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateRequestBodyTiers 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, + ) + # set to None if ids (nullable) is None + # and model_fields_set contains the field + if self.ids is None and "ids" in self.model_fields_set: + _dict['ids'] = None + + # set to None if hierarchy_mode (nullable) is None + # and model_fields_set contains the field + if self.hierarchy_mode is None and "hierarchy_mode" in self.model_fields_set: + _dict['hierarchy_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateRequestBodyTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "hierarchy_mode": obj.get("hierarchy_mode") if obj.get("hierarchy_mode") is not None else 'MANUAL' + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_create_response_body.py b/voucherify/models/promotions_stacks_create_response_body.py new file mode 100644 index 00000000..fe82b7fa --- /dev/null +++ b/voucherify/models/promotions_stacks_create_response_body.py @@ -0,0 +1,165 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_stack_base import PromotionStackBase +from voucherify.models.promotions_stacks_create_response_body_tiers import PromotionsStacksCreateResponseBodyTiers +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/promotions/{campaignId}/stacks`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Promotion stack name.") + tiers: Optional[PromotionsStacksCreateResponseBodyTiers] = None + id: Optional[StrictStr] = Field(default=None, description="Unique promotion stack ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion stack's parent campaign's unique ID.") + object: Optional[StrictStr] = Field(default='promotion_stack', description="The type of the object represented by JSON.") + category_id: Optional[StrictStr] = Field(default=None, description="Promotion stack category ID.") + categories: Optional[List[PromotionStackBase]] = Field(default=None, description="Details about the category assigned to the promotion stack.") + __properties: ClassVar[List[str]] = ["name", "tiers", "id", "created_at", "campaign_id", "object", "category_id", "categories"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['promotion_stack']): + raise ValueError("must be one of enum values ('promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateResponseBody 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 tiers + if self.tiers: + _dict['tiers'] = self.tiers.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateResponseBody 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"), + "tiers": PromotionsStacksCreateResponseBodyTiers.from_dict(obj["tiers"]) if obj.get("tiers") is not None else None, + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "campaign_id": obj.get("campaign_id"), + "object": obj.get("object") if obj.get("object") is not None else 'promotion_stack', + "category_id": obj.get("category_id"), + "categories": [PromotionStackBase.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_create_response_body_tiers.py b/voucherify/models/promotions_stacks_create_response_body_tiers.py new file mode 100644 index 00000000..4ceb0ee0 --- /dev/null +++ b/voucherify/models/promotions_stacks_create_response_body_tiers.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksCreateResponseBodyTiers(BaseModel): + """ + Contains the tier configuration. A promotion stack can include up to 30 tiers. + """ # noqa: E501 + ids: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, description="Contains the list of tiers in a pre-defined sequence.") + hierarchy_mode: Optional[StrictStr] = 'MANUAL' + __properties: ClassVar[List[str]] = ["ids", "hierarchy_mode"] + + @field_validator('hierarchy_mode') + def hierarchy_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateResponseBodyTiers 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, + ) + # set to None if ids (nullable) is None + # and model_fields_set contains the field + if self.ids is None and "ids" in self.model_fields_set: + _dict['ids'] = None + + # set to None if hierarchy_mode (nullable) is None + # and model_fields_set contains the field + if self.hierarchy_mode is None and "hierarchy_mode" in self.model_fields_set: + _dict['hierarchy_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksCreateResponseBodyTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "hierarchy_mode": obj.get("hierarchy_mode") if obj.get("hierarchy_mode") is not None else 'MANUAL' + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_get_response_body.py b/voucherify/models/promotions_stacks_get_response_body.py new file mode 100644 index 00000000..561a2751 --- /dev/null +++ b/voucherify/models/promotions_stacks_get_response_body.py @@ -0,0 +1,172 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotions_stacks_get_response_body_tiers import PromotionsStacksGetResponseBodyTiers +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/promotions/{campaignId}/stacks/{stackId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Promotion stack name.") + tiers: Optional[PromotionsStacksGetResponseBodyTiers] = None + id: Optional[StrictStr] = Field(default=None, description="Unique promotion stack ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion stack's parent campaign's unique ID.") + object: Optional[StrictStr] = Field(default='promotion_stack', description="The type of the object represented by JSON. ") + category_id: Optional[StrictStr] = Field(default=None, description="Promotion stack category ID.") + categories: Optional[List[Category]] = Field(default=None, description="Details about the category assigned to the promotion stack.") + __properties: ClassVar[List[str]] = ["name", "tiers", "id", "created_at", "updated_at", "campaign_id", "object", "category_id", "categories"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['promotion_stack']): + raise ValueError("must be one of enum values ('promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksGetResponseBody 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 tiers + if self.tiers: + _dict['tiers'] = self.tiers.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksGetResponseBody 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"), + "tiers": PromotionsStacksGetResponseBodyTiers.from_dict(obj["tiers"]) if obj.get("tiers") is not None else None, + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "campaign_id": obj.get("campaign_id"), + "object": obj.get("object") if obj.get("object") is not None else 'promotion_stack', + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_get_response_body_tiers.py b/voucherify/models/promotions_stacks_get_response_body_tiers.py new file mode 100644 index 00000000..6e9c6ed8 --- /dev/null +++ b/voucherify/models/promotions_stacks_get_response_body_tiers.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksGetResponseBodyTiers(BaseModel): + """ + Contains the tier configuration. A promotion stack can include up to 30 tiers. + """ # noqa: E501 + ids: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, description="Contains the list of tiers in a pre-defined sequence.") + hierarchy_mode: Optional[StrictStr] = 'MANUAL' + __properties: ClassVar[List[str]] = ["ids", "hierarchy_mode"] + + @field_validator('hierarchy_mode') + def hierarchy_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksGetResponseBodyTiers 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, + ) + # set to None if ids (nullable) is None + # and model_fields_set contains the field + if self.ids is None and "ids" in self.model_fields_set: + _dict['ids'] = None + + # set to None if hierarchy_mode (nullable) is None + # and model_fields_set contains the field + if self.hierarchy_mode is None and "hierarchy_mode" in self.model_fields_set: + _dict['hierarchy_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksGetResponseBodyTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "hierarchy_mode": obj.get("hierarchy_mode") if obj.get("hierarchy_mode") is not None else 'MANUAL' + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_list_response_body.py b/voucherify/models/promotions_stacks_list_response_body.py new file mode 100644 index 00000000..994ed4f5 --- /dev/null +++ b/voucherify/models/promotions_stacks_list_response_body.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.promotion_stack import PromotionStack +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/promotions/stacks` and for **GET** `v1/promotions/{campaignId}/stacks`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about promotion stacks in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of promotion stack objects.") + data: Optional[List[PromotionStack]] = Field(default=None, description="Contains array of promotion stack objects.") + total: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Total number of promotion stacks.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [PromotionStack.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_update_request_body.py b/voucherify/models/promotions_stacks_update_request_body.py new file mode 100644 index 00000000..0d03aca9 --- /dev/null +++ b/voucherify/models/promotions_stacks_update_request_body.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_stacks_update_request_body_tiers import PromotionsStacksUpdateRequestBodyTiers +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksUpdateRequestBody(BaseModel): + """ + Request Body schema for **PUT** `v1/promotions/{campaignId}/stacks/{stackId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Promotion stack name.") + tiers: Optional[PromotionsStacksUpdateRequestBodyTiers] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion stack category ID.") + __properties: ClassVar[List[str]] = ["name", "tiers", "category_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateRequestBody 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 tiers + if self.tiers: + _dict['tiers'] = self.tiers.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateRequestBody 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"), + "tiers": PromotionsStacksUpdateRequestBodyTiers.from_dict(obj["tiers"]) if obj.get("tiers") is not None else None, + "category_id": obj.get("category_id") + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_update_request_body_tiers.py b/voucherify/models/promotions_stacks_update_request_body_tiers.py new file mode 100644 index 00000000..51b2c58d --- /dev/null +++ b/voucherify/models/promotions_stacks_update_request_body_tiers.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class PromotionsStacksUpdateRequestBodyTiers(BaseModel): + """ + Contains the tier configuration. A promotion stack can include up to 30 tiers. + """ # noqa: E501 + ids: Optional[List[StrictStr]] = Field(default=None, description="Contains the list of tiers in a pre-defined sequence.") + hierarchy_mode: Optional[StrictStr] = Field(default='MANUAL', description="Category hierarchy.") + __properties: ClassVar[List[str]] = ["ids", "hierarchy_mode"] + + @field_validator('hierarchy_mode') + def hierarchy_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateRequestBodyTiers 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, + ) + # set to None if ids (nullable) is None + # and model_fields_set contains the field + if self.ids is None and "ids" in self.model_fields_set: + _dict['ids'] = None + + # set to None if hierarchy_mode (nullable) is None + # and model_fields_set contains the field + if self.hierarchy_mode is None and "hierarchy_mode" in self.model_fields_set: + _dict['hierarchy_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateRequestBodyTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "hierarchy_mode": obj.get("hierarchy_mode") if obj.get("hierarchy_mode") is not None else 'MANUAL' + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_update_response_body.py b/voucherify/models/promotions_stacks_update_response_body.py new file mode 100644 index 00000000..f5371d3b --- /dev/null +++ b/voucherify/models/promotions_stacks_update_response_body.py @@ -0,0 +1,172 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_stack_base import PromotionStackBase +from voucherify.models.promotions_stacks_update_response_body_tiers import PromotionsStacksUpdateResponseBodyTiers +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/promotions/{campaignId}/stacks/{stackId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Promotion stack name.") + tiers: Optional[PromotionsStacksUpdateResponseBodyTiers] = None + id: Optional[StrictStr] = Field(default=None, description="Unique promotion stack ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion stack was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion stack was updated. The value is shown in the ISO 8601 format.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion stack's parent campaign's unique ID.") + object: Optional[StrictStr] = Field(default='promotion_stack', description="The type of the object represented by JSON. ") + category_id: Optional[StrictStr] = Field(default=None, description="Promotion stack category ID.") + categories: Optional[List[PromotionStackBase]] = Field(default=None, description="Details about the category assigned to the promotion stack.") + __properties: ClassVar[List[str]] = ["name", "tiers", "id", "created_at", "updated_at", "campaign_id", "object", "category_id", "categories"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['promotion_stack']): + raise ValueError("must be one of enum values ('promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateResponseBody 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 tiers + if self.tiers: + _dict['tiers'] = self.tiers.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateResponseBody 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"), + "tiers": PromotionsStacksUpdateResponseBodyTiers.from_dict(obj["tiers"]) if obj.get("tiers") is not None else None, + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "campaign_id": obj.get("campaign_id"), + "object": obj.get("object") if obj.get("object") is not None else 'promotion_stack', + "category_id": obj.get("category_id"), + "categories": [PromotionStackBase.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_stacks_update_response_body_tiers.py b/voucherify/models/promotions_stacks_update_response_body_tiers.py new file mode 100644 index 00000000..f1d5a955 --- /dev/null +++ b/voucherify/models/promotions_stacks_update_response_body_tiers.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class PromotionsStacksUpdateResponseBodyTiers(BaseModel): + """ + Contains the tier configuration. A promotion stack can include up to 30 tiers. + """ # noqa: E501 + ids: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, description="Contains the list of tiers in a pre-defined sequence.") + hierarchy_mode: Optional[StrictStr] = 'MANUAL' + __properties: ClassVar[List[str]] = ["ids", "hierarchy_mode"] + + @field_validator('hierarchy_mode') + def hierarchy_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateResponseBodyTiers 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, + ) + # set to None if ids (nullable) is None + # and model_fields_set contains the field + if self.ids is None and "ids" in self.model_fields_set: + _dict['ids'] = None + + # set to None if hierarchy_mode (nullable) is None + # and model_fields_set contains the field + if self.hierarchy_mode is None and "hierarchy_mode" in self.model_fields_set: + _dict['hierarchy_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsStacksUpdateResponseBodyTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ids": obj.get("ids"), + "hierarchy_mode": obj.get("hierarchy_mode") if obj.get("hierarchy_mode") is not None else 'MANUAL' + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_request_body.py b/voucherify/models/promotions_tiers_create_request_body.py new file mode 100644 index 00000000..726e82f0 --- /dev/null +++ b/voucherify/models/promotions_tiers_create_request_body.py @@ -0,0 +1,192 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_tiers_create_request_body_action import PromotionsTiersCreateRequestBodyAction +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/v1/promotions/{campaignId}/tiers`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionsTiersCreateRequestBodyAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category: Optional[StrictStr] = Field(default=None, description="Assign a new or update the promotion tier's category using name.") + category_id: Optional[StrictStr] = Field(default=None, description="Assign a new or update the promotion tier's category using id") + __properties: ClassVar[List[str]] = ["name", "banner", "action", "metadata", "hierarchy", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "validation_rule_assignments", "category", "category_id"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateRequestBody 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateRequestBody 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"), + "banner": obj.get("banner"), + "action": PromotionsTiersCreateRequestBodyAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category": obj.get("category"), + "category_id": obj.get("category_id") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_request_body_action.py b/voucherify/models/promotions_tiers_create_request_body_action.py new file mode 100644 index 00000000..a5eaaffd --- /dev/null +++ b/voucherify/models/promotions_tiers_create_request_body_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateRequestBodyAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateRequestBodyAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateRequestBodyAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_response_body.py b/voucherify/models/promotions_tiers_create_response_body.py new file mode 100644 index 00000000..ea8309b9 --- /dev/null +++ b/voucherify/models/promotions_tiers_create_response_body.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotions_tiers_create_response_body_action import PromotionsTiersCreateResponseBodyAction +from voucherify.models.promotions_tiers_create_response_body_campaign import PromotionsTiersCreateResponseBodyCampaign +from voucherify.models.promotions_tiers_create_response_body_summary import PromotionsTiersCreateResponseBodySummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/promotions/{campaignId}/tiers`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionsTiersCreateResponseBodyAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[PromotionsTiersCreateResponseBodyCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[PromotionsTiersCreateResponseBodySummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBody 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBody 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": PromotionsTiersCreateResponseBodyAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": PromotionsTiersCreateResponseBodyCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": PromotionsTiersCreateResponseBodySummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_response_body_action.py b/voucherify/models/promotions_tiers_create_response_body_action.py new file mode 100644 index 00000000..57b7f0bf --- /dev/null +++ b/voucherify/models/promotions_tiers_create_response_body_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateResponseBodyAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodyAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodyAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_response_body_campaign.py b/voucherify/models/promotions_tiers_create_response_body_campaign.py new file mode 100644 index 00000000..3ea887ad --- /dev/null +++ b/voucherify/models/promotions_tiers_create_response_body_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateResponseBodyCampaign(BaseModel): + """ + Contains details about promotion tier's parent campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodyCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodyCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_response_body_summary.py b/voucherify/models/promotions_tiers_create_response_body_summary.py new file mode 100644 index 00000000..9e9229f5 --- /dev/null +++ b/voucherify/models/promotions_tiers_create_response_body_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_tiers_create_response_body_summary_orders import PromotionsTiersCreateResponseBodySummaryOrders +from voucherify.models.promotions_tiers_create_response_body_summary_redemptions import PromotionsTiersCreateResponseBodySummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateResponseBodySummary(BaseModel): + """ + Contains statistics about promotion tier redemptions and orders. + """ # noqa: E501 + redemptions: Optional[PromotionsTiersCreateResponseBodySummaryRedemptions] = None + orders: Optional[PromotionsTiersCreateResponseBodySummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodySummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodySummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": PromotionsTiersCreateResponseBodySummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": PromotionsTiersCreateResponseBodySummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_response_body_summary_orders.py b/voucherify/models/promotions_tiers_create_response_body_summary_orders.py new file mode 100644 index 00000000..e4566ca9 --- /dev/null +++ b/voucherify/models/promotions_tiers_create_response_body_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateResponseBodySummaryOrders(BaseModel): + """ + Contains statistics about orders related to the promotion tier. + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodySummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodySummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_create_response_body_summary_redemptions.py b/voucherify/models/promotions_tiers_create_response_body_summary_redemptions.py new file mode 100644 index 00000000..12d9226c --- /dev/null +++ b/voucherify/models/promotions_tiers_create_response_body_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersCreateResponseBodySummaryRedemptions(BaseModel): + """ + Contains statistics about promotion tier redemptions. + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodySummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersCreateResponseBodySummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_disable_response_body.py b/voucherify/models/promotions_tiers_disable_response_body.py new file mode 100644 index 00000000..6d1ba9fb --- /dev/null +++ b/voucherify/models/promotions_tiers_disable_response_body.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotions_tiers_disable_response_body_action import PromotionsTiersDisableResponseBodyAction +from voucherify.models.promotions_tiers_disable_response_body_campaign import PromotionsTiersDisableResponseBodyCampaign +from voucherify.models.promotions_tiers_disable_response_body_summary import PromotionsTiersDisableResponseBodySummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersDisableResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/promotions/tiers/{promotionTierId}/disable`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionsTiersDisableResponseBodyAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[PromotionsTiersDisableResponseBodyCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[PromotionsTiersDisableResponseBodySummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBody 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBody 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": PromotionsTiersDisableResponseBodyAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": PromotionsTiersDisableResponseBodyCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": PromotionsTiersDisableResponseBodySummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_disable_response_body_action.py b/voucherify/models/promotions_tiers_disable_response_body_action.py new file mode 100644 index 00000000..6af6344c --- /dev/null +++ b/voucherify/models/promotions_tiers_disable_response_body_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersDisableResponseBodyAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodyAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodyAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_disable_response_body_campaign.py b/voucherify/models/promotions_tiers_disable_response_body_campaign.py new file mode 100644 index 00000000..d95faa9c --- /dev/null +++ b/voucherify/models/promotions_tiers_disable_response_body_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersDisableResponseBodyCampaign(BaseModel): + """ + Contains details about promotion tier's parent campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodyCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodyCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_disable_response_body_summary.py b/voucherify/models/promotions_tiers_disable_response_body_summary.py new file mode 100644 index 00000000..ef028ed7 --- /dev/null +++ b/voucherify/models/promotions_tiers_disable_response_body_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_tiers_disable_response_body_summary_orders import PromotionsTiersDisableResponseBodySummaryOrders +from voucherify.models.promotions_tiers_disable_response_body_summary_redemptions import PromotionsTiersDisableResponseBodySummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersDisableResponseBodySummary(BaseModel): + """ + Contains statistics about promotion tier redemptions and orders. + """ # noqa: E501 + redemptions: Optional[PromotionsTiersDisableResponseBodySummaryRedemptions] = None + orders: Optional[PromotionsTiersDisableResponseBodySummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodySummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodySummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": PromotionsTiersDisableResponseBodySummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": PromotionsTiersDisableResponseBodySummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_disable_response_body_summary_orders.py b/voucherify/models/promotions_tiers_disable_response_body_summary_orders.py new file mode 100644 index 00000000..4daf277e --- /dev/null +++ b/voucherify/models/promotions_tiers_disable_response_body_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersDisableResponseBodySummaryOrders(BaseModel): + """ + Contains statistics about orders related to the promotion tier. + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodySummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodySummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_disable_response_body_summary_redemptions.py b/voucherify/models/promotions_tiers_disable_response_body_summary_redemptions.py new file mode 100644 index 00000000..80155676 --- /dev/null +++ b/voucherify/models/promotions_tiers_disable_response_body_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersDisableResponseBodySummaryRedemptions(BaseModel): + """ + Contains statistics about promotion tier redemptions. + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodySummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersDisableResponseBodySummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_enable_response_body.py b/voucherify/models/promotions_tiers_enable_response_body.py new file mode 100644 index 00000000..235724a2 --- /dev/null +++ b/voucherify/models/promotions_tiers_enable_response_body.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotions_tiers_enable_response_body_action import PromotionsTiersEnableResponseBodyAction +from voucherify.models.promotions_tiers_enable_response_body_campaign import PromotionsTiersEnableResponseBodyCampaign +from voucherify.models.promotions_tiers_enable_response_body_summary import PromotionsTiersEnableResponseBodySummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersEnableResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/promotions/tiers/{promotionTierId}/enable`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionsTiersEnableResponseBodyAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[PromotionsTiersEnableResponseBodyCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[PromotionsTiersEnableResponseBodySummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBody 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBody 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": PromotionsTiersEnableResponseBodyAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": PromotionsTiersEnableResponseBodyCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": PromotionsTiersEnableResponseBodySummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_enable_response_body_action.py b/voucherify/models/promotions_tiers_enable_response_body_action.py new file mode 100644 index 00000000..828a3c8d --- /dev/null +++ b/voucherify/models/promotions_tiers_enable_response_body_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersEnableResponseBodyAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodyAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodyAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_enable_response_body_campaign.py b/voucherify/models/promotions_tiers_enable_response_body_campaign.py new file mode 100644 index 00000000..9b9bb491 --- /dev/null +++ b/voucherify/models/promotions_tiers_enable_response_body_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersEnableResponseBodyCampaign(BaseModel): + """ + Contains details about promotion tier's parent campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodyCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodyCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_enable_response_body_summary.py b/voucherify/models/promotions_tiers_enable_response_body_summary.py new file mode 100644 index 00000000..7fea1eaa --- /dev/null +++ b/voucherify/models/promotions_tiers_enable_response_body_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_tiers_enable_response_body_summary_orders import PromotionsTiersEnableResponseBodySummaryOrders +from voucherify.models.promotions_tiers_enable_response_body_summary_redemptions import PromotionsTiersEnableResponseBodySummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersEnableResponseBodySummary(BaseModel): + """ + Contains statistics about promotion tier redemptions and orders. + """ # noqa: E501 + redemptions: Optional[PromotionsTiersEnableResponseBodySummaryRedemptions] = None + orders: Optional[PromotionsTiersEnableResponseBodySummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodySummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodySummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": PromotionsTiersEnableResponseBodySummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": PromotionsTiersEnableResponseBodySummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_enable_response_body_summary_orders.py b/voucherify/models/promotions_tiers_enable_response_body_summary_orders.py new file mode 100644 index 00000000..2bd24d4a --- /dev/null +++ b/voucherify/models/promotions_tiers_enable_response_body_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersEnableResponseBodySummaryOrders(BaseModel): + """ + Contains statistics about orders related to the promotion tier. + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodySummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodySummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_enable_response_body_summary_redemptions.py b/voucherify/models/promotions_tiers_enable_response_body_summary_redemptions.py new file mode 100644 index 00000000..76eac6cf --- /dev/null +++ b/voucherify/models/promotions_tiers_enable_response_body_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersEnableResponseBodySummaryRedemptions(BaseModel): + """ + Contains statistics about promotion tier redemptions. + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodySummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersEnableResponseBodySummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_get_response_body.py b/voucherify/models/promotions_tiers_get_response_body.py new file mode 100644 index 00000000..69007847 --- /dev/null +++ b/voucherify/models/promotions_tiers_get_response_body.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotions_tiers_get_response_body_action import PromotionsTiersGetResponseBodyAction +from voucherify.models.promotions_tiers_get_response_body_campaign import PromotionsTiersGetResponseBodyCampaign +from voucherify.models.promotions_tiers_get_response_body_summary import PromotionsTiersGetResponseBodySummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/promotions/tiers/{promotionTierId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionsTiersGetResponseBodyAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[PromotionsTiersGetResponseBodyCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[PromotionsTiersGetResponseBodySummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBody 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBody 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": PromotionsTiersGetResponseBodyAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": PromotionsTiersGetResponseBodyCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": PromotionsTiersGetResponseBodySummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_get_response_body_action.py b/voucherify/models/promotions_tiers_get_response_body_action.py new file mode 100644 index 00000000..60bf64f3 --- /dev/null +++ b/voucherify/models/promotions_tiers_get_response_body_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersGetResponseBodyAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodyAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodyAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_get_response_body_campaign.py b/voucherify/models/promotions_tiers_get_response_body_campaign.py new file mode 100644 index 00000000..d5781916 --- /dev/null +++ b/voucherify/models/promotions_tiers_get_response_body_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersGetResponseBodyCampaign(BaseModel): + """ + Contains details about promotion tier's parent campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodyCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodyCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_get_response_body_summary.py b/voucherify/models/promotions_tiers_get_response_body_summary.py new file mode 100644 index 00000000..5d962922 --- /dev/null +++ b/voucherify/models/promotions_tiers_get_response_body_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_tiers_get_response_body_summary_orders import PromotionsTiersGetResponseBodySummaryOrders +from voucherify.models.promotions_tiers_get_response_body_summary_redemptions import PromotionsTiersGetResponseBodySummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersGetResponseBodySummary(BaseModel): + """ + Contains statistics about promotion tier redemptions and orders. + """ # noqa: E501 + redemptions: Optional[PromotionsTiersGetResponseBodySummaryRedemptions] = None + orders: Optional[PromotionsTiersGetResponseBodySummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodySummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodySummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": PromotionsTiersGetResponseBodySummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": PromotionsTiersGetResponseBodySummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_get_response_body_summary_orders.py b/voucherify/models/promotions_tiers_get_response_body_summary_orders.py new file mode 100644 index 00000000..e77ba28a --- /dev/null +++ b/voucherify/models/promotions_tiers_get_response_body_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersGetResponseBodySummaryOrders(BaseModel): + """ + Contains statistics about orders related to the promotion tier. + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodySummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodySummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_get_response_body_summary_redemptions.py b/voucherify/models/promotions_tiers_get_response_body_summary_redemptions.py new file mode 100644 index 00000000..25fcd3f1 --- /dev/null +++ b/voucherify/models/promotions_tiers_get_response_body_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersGetResponseBodySummaryRedemptions(BaseModel): + """ + Contains statistics about promotion tier redemptions. + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodySummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersGetResponseBodySummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_list_response_body.py b/voucherify/models/promotions_tiers_list_response_body.py new file mode 100644 index 00000000..7e66aabb --- /dev/null +++ b/voucherify/models/promotions_tiers_list_response_body.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotion_tier import PromotionTier +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/promotions/{campaignId}/tiers` and **GET** `v1/promotions/tiers`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about promotion tiers in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='tiers', description="Identifies the name of the attribute that contains the array of promotion tier objects.") + tiers: Optional[List[PromotionTier]] = Field(default=None, description="Contains array of promotion tier objects.") + total: Optional[StrictInt] = Field(default=None, description="Total number of promotion tiers.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request to get more records returned in the results.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "tiers", "total", "has_more"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersListResponseBody 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 tiers (list) + _items = [] + if self.tiers: + for _item_tiers in self.tiers: + if _item_tiers: + _items.append(_item_tiers.to_dict()) + _dict['tiers'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if tiers (nullable) is None + # and model_fields_set contains the field + if self.tiers is None and "tiers" in self.model_fields_set: + _dict['tiers'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'tiers', + "tiers": [PromotionTier.from_dict(_item) for _item in obj["tiers"]] if obj.get("tiers") is not None else None, + "total": obj.get("total"), + "has_more": obj.get("has_more") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_request_body.py b/voucherify/models/promotions_tiers_update_request_body.py new file mode 100644 index 00000000..d38e204a --- /dev/null +++ b/voucherify/models/promotions_tiers_update_request_body.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.promotions_tiers_update_request_body_action import PromotionsTiersUpdateRequestBodyAction +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateRequestBody(BaseModel): + """ + Request body schema for **PUT** `v1/promotions/tiers/{promotionTierId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionsTiersUpdateRequestBodyAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category: Optional[StrictStr] = Field(default=None, description="Assign a new or update the promotion tier's category using name.") + category_id: Optional[StrictStr] = Field(default=None, description="Assign a new or update the promotion tier's category using id") + __properties: ClassVar[List[str]] = ["name", "banner", "action", "metadata", "hierarchy", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "validation_rule_assignments", "category", "category_id"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateRequestBody 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateRequestBody 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"), + "banner": obj.get("banner"), + "action": PromotionsTiersUpdateRequestBodyAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category": obj.get("category"), + "category_id": obj.get("category_id") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_request_body_action.py b/voucherify/models/promotions_tiers_update_request_body_action.py new file mode 100644 index 00000000..c13cca34 --- /dev/null +++ b/voucherify/models/promotions_tiers_update_request_body_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateRequestBodyAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateRequestBodyAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateRequestBodyAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_response_body.py b/voucherify/models/promotions_tiers_update_response_body.py new file mode 100644 index 00000000..5e924156 --- /dev/null +++ b/voucherify/models/promotions_tiers_update_response_body.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.promotions_tiers_update_response_body_action import PromotionsTiersUpdateResponseBodyAction +from voucherify.models.promotions_tiers_update_response_body_campaign import PromotionsTiersUpdateResponseBodyCampaign +from voucherify.models.promotions_tiers_update_response_body_summary import PromotionsTiersUpdateResponseBodySummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/promotions/tiers/{promotionTierId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[PromotionsTiersUpdateResponseBodyAction] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.") + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[PromotionsTiersUpdateResponseBodyCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[PromotionsTiersUpdateResponseBodySummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBody 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBody 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": PromotionsTiersUpdateResponseBodyAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": PromotionsTiersUpdateResponseBodyCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": PromotionsTiersUpdateResponseBodySummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_response_body_action.py b/voucherify/models/promotions_tiers_update_response_body_action.py new file mode 100644 index 00000000..c15b554e --- /dev/null +++ b/voucherify/models/promotions_tiers_update_response_body_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateResponseBodyAction(BaseModel): + """ + Contains details about the discount applied by the promotion tier. + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodyAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodyAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_response_body_campaign.py b/voucherify/models/promotions_tiers_update_response_body_campaign.py new file mode 100644 index 00000000..170fadc8 --- /dev/null +++ b/voucherify/models/promotions_tiers_update_response_body_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateResponseBodyCampaign(BaseModel): + """ + Contains details about promotion tier's parent campaign. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodyCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodyCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_response_body_summary.py b/voucherify/models/promotions_tiers_update_response_body_summary.py new file mode 100644 index 00000000..abfc9f6a --- /dev/null +++ b/voucherify/models/promotions_tiers_update_response_body_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.promotions_tiers_update_response_body_summary_orders import PromotionsTiersUpdateResponseBodySummaryOrders +from voucherify.models.promotions_tiers_update_response_body_summary_redemptions import PromotionsTiersUpdateResponseBodySummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateResponseBodySummary(BaseModel): + """ + Contains statistics about promotion tier redemptions and orders. + """ # noqa: E501 + redemptions: Optional[PromotionsTiersUpdateResponseBodySummaryRedemptions] = None + orders: Optional[PromotionsTiersUpdateResponseBodySummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodySummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodySummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": PromotionsTiersUpdateResponseBodySummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": PromotionsTiersUpdateResponseBodySummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_response_body_summary_orders.py b/voucherify/models/promotions_tiers_update_response_body_summary_orders.py new file mode 100644 index 00000000..aa61dc8a --- /dev/null +++ b/voucherify/models/promotions_tiers_update_response_body_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateResponseBodySummaryOrders(BaseModel): + """ + Contains statistics about orders related to the promotion tier. + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodySummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodySummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/promotions_tiers_update_response_body_summary_redemptions.py b/voucherify/models/promotions_tiers_update_response_body_summary_redemptions.py new file mode 100644 index 00000000..25958c62 --- /dev/null +++ b/voucherify/models/promotions_tiers_update_response_body_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PromotionsTiersUpdateResponseBodySummaryRedemptions(BaseModel): + """ + Contains statistics about promotion tier redemptions. + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodySummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PromotionsTiersUpdateResponseBodySummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/publications_create_request_body.py b/voucherify/models/publications_create_request_body.py new file mode 100644 index 00000000..99d3ccc8 --- /dev/null +++ b/voucherify/models/publications_create_request_body.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.create_publication_campaign import CreatePublicationCampaign +from voucherify.models.publications_create_request_body_customer import PublicationsCreateRequestBodyCustomer +from typing import Optional, Set +from typing_extensions import Self + +class PublicationsCreateRequestBody(BaseModel): + """ + PublicationsCreateRequestBody + """ # noqa: E501 + voucher: Optional[StrictStr] = Field(default=None, description="Code of the voucher being published.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. If `source_id` is provided only 1 voucher can be published per request.") + customer: Optional[PublicationsCreateRequestBodyCustomer] = None + metadata: Optional[Dict[str, Any]] = None + channel: Optional[StrictStr] = Field(default=None, description="Specify the distribution channel.") + campaign: Optional[CreatePublicationCampaign] = None + __properties: ClassVar[List[str]] = ["voucher", "source_id", "customer", "metadata", "channel", "campaign"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicationsCreateRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # set to None if voucher (nullable) is None + # and model_fields_set contains the field + if self.voucher is None and "voucher" in self.model_fields_set: + _dict['voucher'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicationsCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "voucher": obj.get("voucher"), + "source_id": obj.get("source_id"), + "customer": PublicationsCreateRequestBodyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "metadata": obj.get("metadata"), + "channel": obj.get("channel"), + "campaign": CreatePublicationCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None + }) + return _obj + + diff --git a/voucherify/models/publications_create_request_body_customer.py b/voucherify/models/publications_create_request_body_customer.py new file mode 100644 index 00000000..745cd37e --- /dev/null +++ b/voucherify/models/publications_create_request_body_customer.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.publications_create_request_body_customer_address import PublicationsCreateRequestBodyCustomerAddress +from typing import Optional, Set +from typing_extensions import Self + +class PublicationsCreateRequestBodyCustomer(BaseModel): + """ + PublicationsCreateRequestBodyCustomer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[PublicationsCreateRequestBodyCustomerAddress] = None + metadata: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicationsCreateRequestBodyCustomer 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 address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicationsCreateRequestBodyCustomer 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": PublicationsCreateRequestBodyCustomerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/publications_create_request_body_customer_address.py b/voucherify/models/publications_create_request_body_customer_address.py new file mode 100644 index 00000000..fa69cdc8 --- /dev/null +++ b/voucherify/models/publications_create_request_body_customer_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PublicationsCreateRequestBodyCustomerAddress(BaseModel): + """ + PublicationsCreateRequestBodyCustomerAddress + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicationsCreateRequestBodyCustomerAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicationsCreateRequestBodyCustomerAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/publications_create_response_body.py b/voucherify/models/publications_create_response_body.py new file mode 100644 index 00000000..e94989f6 --- /dev/null +++ b/voucherify/models/publications_create_response_body.py @@ -0,0 +1,206 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_with_summary_loyalty_referrals import CustomerWithSummaryLoyaltyReferrals +from voucherify.models.voucher import Voucher +from typing import Optional, Set +from typing_extensions import Self + +class PublicationsCreateResponseBody(BaseModel): + """ + PublicationsCreateResponseBody + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique publication ID, assigned by Voucherify.") + object: Optional[StrictStr] = Field(default='publication', description="The type of the object represented by the JSON. This object stores information about the `publication`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer receiving the publication.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Customer's `source_id`.") + metadata: Optional[Dict[str, Any]] = None + channel: Optional[StrictStr] = Field(default='API', description="How the publication was originated. It can be your own custom channel or an example value provided here.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. ") + result: Optional[StrictStr] = Field(default='SUCCESS', description="Status of the publication attempt.") + customer: Optional[CustomerWithSummaryLoyaltyReferrals] = None + vouchers_id: Optional[List[StrictStr]] = Field(default=None, description="Contains the unique internal voucher ID that was assigned by Voucherify.") + voucher: Optional[Voucher] = None + vouchers: Optional[List[StrictStr]] = Field(default=None, description="Contains the unique voucher codes that was assigned by Voucherify.") + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "customer_id", "tracking_id", "metadata", "channel", "source_id", "result", "customer", "vouchers_id", "voucher", "vouchers"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['publication']): + raise ValueError("must be one of enum values ('publication')") + return value + + @field_validator('channel') + def channel_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['API']): + raise ValueError("must be one of enum values ('API')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS']): + raise ValueError("must be one of enum values ('SUCCESS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicationsCreateResponseBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if vouchers_id (nullable) is None + # and model_fields_set contains the field + if self.vouchers_id is None and "vouchers_id" in self.model_fields_set: + _dict['vouchers_id'] = None + + # set to None if vouchers (nullable) is None + # and model_fields_set contains the field + if self.vouchers is None and "vouchers" in self.model_fields_set: + _dict['vouchers'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicationsCreateResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'publication', + "created_at": obj.get("created_at"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "channel": obj.get("channel") if obj.get("channel") is not None else 'API', + "source_id": obj.get("source_id"), + "result": obj.get("result") if obj.get("result") is not None else 'SUCCESS', + "customer": CustomerWithSummaryLoyaltyReferrals.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "vouchers_id": obj.get("vouchers_id"), + "voucher": Voucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "vouchers": obj.get("vouchers") + }) + return _obj + + diff --git a/voucherify/models/publications_list_response_body.py b/voucherify/models/publications_list_response_body.py new file mode 100644 index 00000000..de4af66b --- /dev/null +++ b/voucherify/models/publications_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.publications_list_response_body_publications_item import PublicationsListResponseBodyPublicationsItem +from typing import Optional, Set +from typing_extensions import Self + +class PublicationsListResponseBody(BaseModel): + """ + Response body schema for listing publications using **GET** `v1/publications`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about publications in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='publications', description="Identifies the name of the attribute that contains the array of publications.") + publications: Optional[List[PublicationsListResponseBodyPublicationsItem]] = Field(default=None, description="Response schema model for publishing vouchers to a specific customer.") + total: Optional[StrictInt] = Field(default=None, description="Total number of publications.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "publications", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicationsListResponseBody 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 publications (list) + _items = [] + if self.publications: + for _item_publications in self.publications: + if _item_publications: + _items.append(_item_publications.to_dict()) + _dict['publications'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if publications (nullable) is None + # and model_fields_set contains the field + if self.publications is None and "publications" in self.model_fields_set: + _dict['publications'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicationsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'publications', + "publications": [PublicationsListResponseBodyPublicationsItem.from_dict(_item) for _item in obj["publications"]] if obj.get("publications") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/publications_list_response_body_publications_item.py b/voucherify/models/publications_list_response_body_publications_item.py new file mode 100644 index 00000000..19be05b9 --- /dev/null +++ b/voucherify/models/publications_list_response_body_publications_item.py @@ -0,0 +1,199 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer_with_summary_loyalty_referrals import CustomerWithSummaryLoyaltyReferrals +from voucherify.models.list_publications_item_voucher import ListPublicationsItemVoucher +from voucherify.models.publications_list_response_body_publications_item_metadata import PublicationsListResponseBodyPublicationsItemMetadata +from typing import Optional, Set +from typing_extensions import Self + +class PublicationsListResponseBodyPublicationsItem(BaseModel): + """ + PublicationsListResponseBodyPublicationsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique publication ID, assigned by Voucherify.") + object: Optional[StrictStr] = Field(default='publication', description="The type of the object represented by the JSON. This object stores information about the `publication`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the publication was created. The value is shown in the ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer receiving the publication.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Customer's `source_id`.") + metadata: Optional[PublicationsListResponseBodyPublicationsItemMetadata] = None + channel: Optional[StrictStr] = Field(default=None, description="How the publication was originated. It can be your own custom channel or an example value provided here.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. ") + customer: Optional[CustomerWithSummaryLoyaltyReferrals] = None + vouchers: Optional[List[StrictStr]] = Field(default=None, description="Contains the voucher IDs that was assigned by Voucherify. and Contains the unique voucher codes that was assigned by Voucherify.") + vouchers_id: Optional[List[StrictStr]] = Field(default=None, description="Contains the unique internal voucher IDs that was assigned by Voucherify.") + result: Optional[StrictStr] = None + voucher: Optional[ListPublicationsItemVoucher] = None + failure_code: Optional[StrictStr] = Field(default=None, description="Generic reason as to why the create publication operation failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="This parameter will provide more expanded reason as to why the create publication operation failed.") + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "customer_id", "tracking_id", "metadata", "channel", "source_id", "customer", "vouchers", "vouchers_id", "result", "voucher", "failure_code", "failure_message"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['publication']): + raise ValueError("must be one of enum values ('publication')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicationsListResponseBodyPublicationsItem 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if vouchers_id (nullable) is None + # and model_fields_set contains the field + if self.vouchers_id is None and "vouchers_id" in self.model_fields_set: + _dict['vouchers_id'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicationsListResponseBodyPublicationsItem 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"), + "object": obj.get("object") if obj.get("object") is not None else 'publication', + "created_at": obj.get("created_at"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": PublicationsListResponseBodyPublicationsItemMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "channel": obj.get("channel"), + "source_id": obj.get("source_id"), + "customer": CustomerWithSummaryLoyaltyReferrals.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "vouchers": obj.get("vouchers"), + "vouchers_id": obj.get("vouchers_id"), + "result": obj.get("result"), + "voucher": ListPublicationsItemVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message") + }) + return _obj + + diff --git a/voucherify/models/publications_list_response_body_publications_item_metadata.py b/voucherify/models/publications_list_response_body_publications_item_metadata.py new file mode 100644 index 00000000..32cd9489 --- /dev/null +++ b/voucherify/models/publications_list_response_body_publications_item_metadata.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PublicationsListResponseBodyPublicationsItemMetadata(BaseModel): + """ + PublicationsListResponseBodyPublicationsItemMetadata + """ # noqa: E501 + source_type: Optional[StrictStr] = Field(default=None, description="Defines the type of the distribution source.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the distribution source.") + distribution_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the distribution.") + __properties: ClassVar[List[str]] = ["source_type", "source_id", "distribution_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicationsListResponseBodyPublicationsItemMetadata 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, + ) + # set to None if source_type (nullable) is None + # and model_fields_set contains the field + if self.source_type is None and "source_type" in self.model_fields_set: + _dict['source_type'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if distribution_id (nullable) is None + # and model_fields_set contains the field + if self.distribution_id is None and "distribution_id" in self.model_fields_set: + _dict['distribution_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicationsListResponseBodyPublicationsItemMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source_type": obj.get("source_type"), + "source_id": obj.get("source_id"), + "distribution_id": obj.get("distribution_id") + }) + return _obj + + diff --git a/voucherify/models/qualifications_check_eligibility_request_body.py b/voucherify/models/qualifications_check_eligibility_request_body.py new file mode 100644 index 00000000..01dbae72 --- /dev/null +++ b/voucherify/models/qualifications_check_eligibility_request_body.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.customer import Customer +from voucherify.models.order import Order +from voucherify.models.qualifications_option import QualificationsOption +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsCheckEligibilityRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/qualifications`. + """ # noqa: E501 + customer: Optional[Customer] = None + order: Optional[Order] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Is correspondent to Customer's source_id") + scenario: Optional[StrictStr] = Field(default=None, description="Defines the scenario Voucherify should consider during the qualification process. - `ALL` - Scenario that returns all redeemables available for the customer in one API request. This scenario is used by default when no value is selected. - `CUSTOMER_WALLET` - returns vouchers applicable to the customer's cart based on the vouchers assigned to the customer's profile. - `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only. - `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s). - `PROMOTION_STACKS` - returns the applicable promotion stacks. - `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule). - `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s).") + options: Optional[QualificationsOption] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Advanced_ → _Redemption metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _REDEMPTION METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).") + __properties: ClassVar[List[str]] = ["customer", "order", "tracking_id", "scenario", "options", "metadata"] + + @field_validator('scenario') + def scenario_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ALL', 'CUSTOMER_WALLET', 'AUDIENCE_ONLY', 'PRODUCTS', 'PRODUCTS_DISCOUNT', 'PROMOTION_STACKS', 'PRODUCTS_BY_CUSTOMER', 'PRODUCTS_DISCOUNT_BY_CUSTOMER']): + raise ValueError("must be one of enum values ('ALL', 'CUSTOMER_WALLET', 'AUDIENCE_ONLY', 'PRODUCTS', 'PRODUCTS_DISCOUNT', 'PROMOTION_STACKS', 'PRODUCTS_BY_CUSTOMER', 'PRODUCTS_DISCOUNT_BY_CUSTOMER')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsCheckEligibilityRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of options + if self.options: + _dict['options'] = self.options.to_dict() + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if scenario (nullable) is None + # and model_fields_set contains the field + if self.scenario is None and "scenario" in self.model_fields_set: + _dict['scenario'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsCheckEligibilityRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "tracking_id": obj.get("tracking_id"), + "scenario": obj.get("scenario"), + "options": QualificationsOption.from_dict(obj["options"]) if obj.get("options") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/qualifications_check_eligibility_response_body.py b/voucherify/models/qualifications_check_eligibility_response_body.py new file mode 100644 index 00000000..753f8c62 --- /dev/null +++ b/voucherify/models/qualifications_check_eligibility_response_body.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.qualifications_redeemables import QualificationsRedeemables +from voucherify.models.stacking_rules import StackingRules +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsCheckEligibilityResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/qualifications`. + """ # noqa: E501 + redeemables: Optional[QualificationsRedeemables] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID.") + order: Optional[OrderCalculated] = None + stacking_rules: Optional[StackingRules] = None + __properties: ClassVar[List[str]] = ["redeemables", "tracking_id", "order", "stacking_rules"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsCheckEligibilityResponseBody 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 redeemables + if self.redeemables: + _dict['redeemables'] = self.redeemables.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of stacking_rules + if self.stacking_rules: + _dict['stacking_rules'] = self.stacking_rules.to_dict() + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsCheckEligibilityResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redeemables": QualificationsRedeemables.from_dict(obj["redeemables"]) if obj.get("redeemables") is not None else None, + "tracking_id": obj.get("tracking_id"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "stacking_rules": StackingRules.from_dict(obj["stacking_rules"]) if obj.get("stacking_rules") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_field_conditions.py b/voucherify/models/qualifications_field_conditions.py new file mode 100644 index 00000000..e5f06228 --- /dev/null +++ b/voucherify/models/qualifications_field_conditions.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.qualifications_filters_condition import QualificationsFiltersCondition +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsFieldConditions(BaseModel): + """ + QualificationsFieldConditions + """ # noqa: E501 + conditions: Optional[QualificationsFiltersCondition] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsFieldConditions 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsFieldConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": QualificationsFiltersCondition.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_filters_condition.py b/voucherify/models/qualifications_filters_condition.py new file mode 100644 index 00000000..05750c43 --- /dev/null +++ b/voucherify/models/qualifications_filters_condition.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsFiltersCondition(BaseModel): + """ + QualificationsFiltersCondition + """ # noqa: E501 + var_is: Optional[List[StrictStr]] = Field(default=None, alias="$is") + is_not: Optional[List[StrictStr]] = Field(default=None, alias="$is_not") + has_value: Optional[Any] = Field(default=None, alias="$has_value") + is_unknown: Optional[Any] = Field(default=None, alias="$is_unknown") + var_in: Optional[List[StrictStr]] = Field(default=None, alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, alias="$not_in") + __properties: ClassVar[List[str]] = ["$is", "$is_not", "$has_value", "$is_unknown", "$in", "$not_in"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsFiltersCondition 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, + ) + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if has_value (nullable) is None + # and model_fields_set contains the field + if self.has_value is None and "has_value" in self.model_fields_set: + _dict['$has_value'] = None + + # set to None if is_unknown (nullable) is None + # and model_fields_set contains the field + if self.is_unknown is None and "is_unknown" in self.model_fields_set: + _dict['$is_unknown'] = None + + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsFiltersCondition from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$has_value": obj.get("$has_value"), + "$is_unknown": obj.get("$is_unknown"), + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in") + }) + return _obj + + diff --git a/voucherify/models/qualifications_option.py b/voucherify/models/qualifications_option.py new file mode 100644 index 00000000..3135e49e --- /dev/null +++ b/voucherify/models/qualifications_option.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.qualifications_option_filters import QualificationsOptionFilters +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsOption(BaseModel): + """ + Configure parameters returned in the response. + """ # noqa: E501 + limit: Optional[Annotated[int, Field(le=100, strict=True)]] = Field(default=None, description="The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5") + starting_after: Optional[datetime] = Field(default=None, description="Cursor used for paging.") + filters: Optional[QualificationsOptionFilters] = None + expand: Optional[List[StrictStr]] = Field(default=None, description="The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"redeemable\"] | - Returns the redeemables' metadata. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. | | [\"validation_rules\"] | - Returns an expanded `validation_rules` object, showing details about the validation rules. |") + sorting_rule: Optional[StrictStr] = Field(default=None, description="Is used to determine the order in which data is displayed in the result array. - `DEFAULT` - Sorting descending by `created_at` - `BEST_DEAL` - Sorting descending by `total_applied_discount_amount` - `LEAST_DEAL` - Sorting ascending by `total_applied_discount_amount`") + __properties: ClassVar[List[str]] = ["limit", "starting_after", "filters", "expand", "sorting_rule"] + + @field_validator('expand') + def expand_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['redeemable', 'category', 'validation_rules']): + raise ValueError("each list item must be one of ('redeemable', 'category', 'validation_rules')") + return value + + @field_validator('sorting_rule') + def sorting_rule_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['BEST_DEAL', 'LEAST_DEAL', 'DEFAULT']): + raise ValueError("must be one of enum values ('BEST_DEAL', 'LEAST_DEAL', 'DEFAULT')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOption 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if limit (nullable) is None + # and model_fields_set contains the field + if self.limit is None and "limit" in self.model_fields_set: + _dict['limit'] = None + + # set to None if starting_after (nullable) is None + # and model_fields_set contains the field + if self.starting_after is None and "starting_after" in self.model_fields_set: + _dict['starting_after'] = None + + # set to None if filters (nullable) is None + # and model_fields_set contains the field + if self.filters is None and "filters" in self.model_fields_set: + _dict['filters'] = None + + # set to None if expand (nullable) is None + # and model_fields_set contains the field + if self.expand is None and "expand" in self.model_fields_set: + _dict['expand'] = None + + # set to None if sorting_rule (nullable) is None + # and model_fields_set contains the field + if self.sorting_rule is None and "sorting_rule" in self.model_fields_set: + _dict['sorting_rule'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "limit": obj.get("limit"), + "starting_after": obj.get("starting_after"), + "filters": QualificationsOptionFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None, + "expand": obj.get("expand"), + "sorting_rule": obj.get("sorting_rule") + }) + return _obj + + diff --git a/voucherify/models/qualifications_option_filters.py b/voucherify/models/qualifications_option_filters.py new file mode 100644 index 00000000..f44fd554 --- /dev/null +++ b/voucherify/models/qualifications_option_filters.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.junction import Junction +from voucherify.models.qualifications_field_conditions import QualificationsFieldConditions +from voucherify.models.qualifications_option_filters_campaign_type import QualificationsOptionFiltersCampaignType +from voucherify.models.qualifications_option_filters_holder_role import QualificationsOptionFiltersHolderRole +from voucherify.models.qualifications_option_filters_resource_type import QualificationsOptionFiltersResourceType +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsOptionFilters(BaseModel): + """ + A set of filters to return only a specific category or type of redeemable. + """ # noqa: E501 + junction: Optional[Junction] = None + category_id: Optional[QualificationsFieldConditions] = None + campaign_id: Optional[QualificationsFieldConditions] = None + campaign_type: Optional[QualificationsOptionFiltersCampaignType] = None + resource_id: Optional[QualificationsFieldConditions] = None + resource_type: Optional[QualificationsOptionFiltersResourceType] = None + voucher_type: Optional[QualificationsFieldConditions] = None + code: Optional[QualificationsFieldConditions] = None + holder_role: Optional[QualificationsOptionFiltersHolderRole] = None + __properties: ClassVar[List[str]] = ["junction", "category_id", "campaign_id", "campaign_type", "resource_id", "resource_type", "voucher_type", "code", "holder_role"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOptionFilters 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 category_id + if self.category_id: + _dict['category_id'] = self.category_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_id + if self.campaign_id: + _dict['campaign_id'] = self.campaign_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign_type + if self.campaign_type: + _dict['campaign_type'] = self.campaign_type.to_dict() + # override the default output from pydantic by calling `to_dict()` of resource_id + if self.resource_id: + _dict['resource_id'] = self.resource_id.to_dict() + # override the default output from pydantic by calling `to_dict()` of resource_type + if self.resource_type: + _dict['resource_type'] = self.resource_type.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher_type + if self.voucher_type: + _dict['voucher_type'] = self.voucher_type.to_dict() + # override the default output from pydantic by calling `to_dict()` of code + if self.code: + _dict['code'] = self.code.to_dict() + # override the default output from pydantic by calling `to_dict()` of holder_role + if self.holder_role: + _dict['holder_role'] = self.holder_role.to_dict() + # set to None if campaign_type (nullable) is None + # and model_fields_set contains the field + if self.campaign_type is None and "campaign_type" in self.model_fields_set: + _dict['campaign_type'] = None + + # set to None if resource_type (nullable) is None + # and model_fields_set contains the field + if self.resource_type is None and "resource_type" in self.model_fields_set: + _dict['resource_type'] = None + + # set to None if holder_role (nullable) is None + # and model_fields_set contains the field + if self.holder_role is None and "holder_role" in self.model_fields_set: + _dict['holder_role'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOptionFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "junction": obj.get("junction"), + "category_id": QualificationsFieldConditions.from_dict(obj["category_id"]) if obj.get("category_id") is not None else None, + "campaign_id": QualificationsFieldConditions.from_dict(obj["campaign_id"]) if obj.get("campaign_id") is not None else None, + "campaign_type": QualificationsOptionFiltersCampaignType.from_dict(obj["campaign_type"]) if obj.get("campaign_type") is not None else None, + "resource_id": QualificationsFieldConditions.from_dict(obj["resource_id"]) if obj.get("resource_id") is not None else None, + "resource_type": QualificationsOptionFiltersResourceType.from_dict(obj["resource_type"]) if obj.get("resource_type") is not None else None, + "voucher_type": QualificationsFieldConditions.from_dict(obj["voucher_type"]) if obj.get("voucher_type") is not None else None, + "code": QualificationsFieldConditions.from_dict(obj["code"]) if obj.get("code") is not None else None, + "holder_role": QualificationsOptionFiltersHolderRole.from_dict(obj["holder_role"]) if obj.get("holder_role") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_option_filters_campaign_type.py b/voucherify/models/qualifications_option_filters_campaign_type.py new file mode 100644 index 00000000..e3ea3181 --- /dev/null +++ b/voucherify/models/qualifications_option_filters_campaign_type.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.qualifications_option_filters_campaign_type_conditions import QualificationsOptionFiltersCampaignTypeConditions +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsOptionFiltersCampaignType(BaseModel): + """ + Returns both campaigns and their vouchers or promotion tiers. Use other filters, e.g. `resource_type`, to narrow down the results. + """ # noqa: E501 + conditions: Optional[QualificationsOptionFiltersCampaignTypeConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersCampaignType 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersCampaignType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": QualificationsOptionFiltersCampaignTypeConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_option_filters_campaign_type_conditions.py b/voucherify/models/qualifications_option_filters_campaign_type_conditions.py new file mode 100644 index 00000000..fd6e0e0f --- /dev/null +++ b/voucherify/models/qualifications_option_filters_campaign_type_conditions.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.parameter_campaign_type import ParameterCampaignType +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsOptionFiltersCampaignTypeConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_is: Optional[List[ParameterCampaignType]] = Field(default=None, alias="$is") + is_not: Optional[List[ParameterCampaignType]] = Field(default=None, alias="$is_not") + var_in: Optional[List[ParameterCampaignType]] = Field(default=None, alias="$in") + not_in: Optional[List[ParameterCampaignType]] = Field(default=None, alias="$not_in") + __properties: ClassVar[List[str]] = ["$is", "$is_not", "$in", "$not_in"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersCampaignTypeConditions 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, + ) + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersCampaignTypeConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in") + }) + return _obj + + diff --git a/voucherify/models/qualifications_option_filters_holder_role.py b/voucherify/models/qualifications_option_filters_holder_role.py new file mode 100644 index 00000000..8f1fed24 --- /dev/null +++ b/voucherify/models/qualifications_option_filters_holder_role.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.qualifications_option_filters_holder_role_conditions import QualificationsOptionFiltersHolderRoleConditions +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsOptionFiltersHolderRole(BaseModel): + """ + QualificationsOptionFiltersHolderRole + """ # noqa: E501 + conditions: Optional[QualificationsOptionFiltersHolderRoleConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersHolderRole 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersHolderRole from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": QualificationsOptionFiltersHolderRoleConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_option_filters_holder_role_conditions.py b/voucherify/models/qualifications_option_filters_holder_role_conditions.py new file mode 100644 index 00000000..889bc9d5 --- /dev/null +++ b/voucherify/models/qualifications_option_filters_holder_role_conditions.py @@ -0,0 +1,158 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class QualificationsOptionFiltersHolderRoleConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_is: Optional[List[StrictStr]] = Field(default=None, description="Will return records only for the first value in the array.", alias="$is") + is_not: Optional[List[StrictStr]] = Field(default=None, description="Will return records only for the first value in the array.", alias="$is_not") + var_in: Optional[List[StrictStr]] = Field(default=None, description="Will return records for the values in the array.", alias="$in") + not_in: Optional[List[StrictStr]] = Field(default=None, description="Will return records for the values in the array.", alias="$not_in") + __properties: ClassVar[List[str]] = ["$is", "$is_not", "$in", "$not_in"] + + @field_validator('var_is') + def var_is_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['OWNER', 'REFERRER', 'REFEREE']): + raise ValueError("each list item must be one of ('OWNER', 'REFERRER', 'REFEREE')") + return value + + @field_validator('is_not') + def is_not_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['OWNER', 'REFERRER', 'REFEREE']): + raise ValueError("each list item must be one of ('OWNER', 'REFERRER', 'REFEREE')") + return value + + @field_validator('var_in') + def var_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['OWNER', 'REFERRER', 'REFEREE']): + raise ValueError("each list item must be one of ('OWNER', 'REFERRER', 'REFEREE')") + return value + + @field_validator('not_in') + def not_in_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['OWNER', 'REFERRER', 'REFEREE']): + raise ValueError("each list item must be one of ('OWNER', 'REFERRER', 'REFEREE')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersHolderRoleConditions 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, + ) + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersHolderRoleConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in") + }) + return _obj + + diff --git a/voucherify/models/qualifications_option_filters_resource_type.py b/voucherify/models/qualifications_option_filters_resource_type.py new file mode 100644 index 00000000..4ee4489f --- /dev/null +++ b/voucherify/models/qualifications_option_filters_resource_type.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.qualifications_option_filters_resource_type_conditions import QualificationsOptionFiltersResourceTypeConditions +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsOptionFiltersResourceType(BaseModel): + """ + QualificationsOptionFiltersResourceType + """ # noqa: E501 + conditions: Optional[QualificationsOptionFiltersResourceTypeConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersResourceType 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersResourceType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": QualificationsOptionFiltersResourceTypeConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_option_filters_resource_type_conditions.py b/voucherify/models/qualifications_option_filters_resource_type_conditions.py new file mode 100644 index 00000000..827da457 --- /dev/null +++ b/voucherify/models/qualifications_option_filters_resource_type_conditions.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.resource_types import ResourceTypes +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsOptionFiltersResourceTypeConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_is: Optional[List[ResourceTypes]] = Field(default=None, alias="$is") + is_not: Optional[List[ResourceTypes]] = Field(default=None, alias="$is_not") + var_in: Optional[List[ResourceTypes]] = Field(default=None, alias="$in") + not_in: Optional[List[ResourceTypes]] = Field(default=None, alias="$not_in") + __properties: ClassVar[List[str]] = ["$is", "$is_not", "$in", "$not_in"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersResourceTypeConditions 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, + ) + # set to None if var_is (nullable) is None + # and model_fields_set contains the field + if self.var_is is None and "var_is" in self.model_fields_set: + _dict['$is'] = None + + # set to None if is_not (nullable) is None + # and model_fields_set contains the field + if self.is_not is None and "is_not" in self.model_fields_set: + _dict['$is_not'] = None + + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + # set to None if not_in (nullable) is None + # and model_fields_set contains the field + if self.not_in is None and "not_in" in self.model_fields_set: + _dict['$not_in'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsOptionFiltersResourceTypeConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$is": obj.get("$is"), + "$is_not": obj.get("$is_not"), + "$in": obj.get("$in"), + "$not_in": obj.get("$not_in") + }) + return _obj + + diff --git a/voucherify/models/qualifications_redeemable.py b/voucherify/models/qualifications_redeemable.py new file mode 100644 index 00000000..15d2545b --- /dev/null +++ b/voucherify/models/qualifications_redeemable.py @@ -0,0 +1,220 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to_result_list import ApplicableToResultList +from voucherify.models.category import Category +from voucherify.models.inapplicable_to_result_list import InapplicableToResultList +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.qualifications_redeemable_base import QualificationsRedeemableBase +from voucherify.models.redeemable_result import RedeemableResult +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsRedeemable(BaseModel): + """ + QualificationsRedeemable + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Id of the redeemable.") + object: Optional[StrictStr] = Field(default=None, description="Object type of the redeemable.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.") + result: Optional[RedeemableResult] = None + order: Optional[OrderCalculated] = None + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + applicable_to: Optional[ApplicableToResultList] = None + inapplicable_to: Optional[InapplicableToResultList] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + categories: Optional[List[Category]] = Field(default=None, description="List of category information.") + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + name: Optional[StrictStr] = Field(default=None, description="Name of the redeemable.") + campaign_name: Optional[StrictStr] = Field(default=None, description="Name of the campaign associated to the redeemable. This field is available only if object is not `campaign`") + campaign_id: Optional[StrictStr] = Field(default=None, description="Id of the campaign associated to the redeemable. This field is available only if object is not `campaign`") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + redeemables: Optional[List[QualificationsRedeemableBase]] = None + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "result", "order", "validation_rule_id", "applicable_to", "inapplicable_to", "metadata", "categories", "banner", "name", "campaign_name", "campaign_id", "validation_rules_assignments", "redeemables"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign', 'promotion_tier', 'promotion_stack', 'voucher']): + raise ValueError("must be one of enum values ('campaign', 'promotion_tier', 'promotion_stack', 'voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsRedeemable 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 result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of inapplicable_to + if self.inapplicable_to: + _dict['inapplicable_to'] = self.inapplicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in redeemables (list) + _items = [] + if self.redeemables: + for _item_redeemables in self.redeemables: + if _item_redeemables: + _items.append(_item_redeemables.to_dict()) + _dict['redeemables'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if campaign_name (nullable) is None + # and model_fields_set contains the field + if self.campaign_name is None and "campaign_name" in self.model_fields_set: + _dict['campaign_name'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if redeemables (nullable) is None + # and model_fields_set contains the field + if self.redeemables is None and "redeemables" in self.model_fields_set: + _dict['redeemables'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsRedeemable 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"), + "object": obj.get("object"), + "created_at": obj.get("created_at"), + "result": RedeemableResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "validation_rule_id": obj.get("validation_rule_id"), + "applicable_to": ApplicableToResultList.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "inapplicable_to": InapplicableToResultList.from_dict(obj["inapplicable_to"]) if obj.get("inapplicable_to") is not None else None, + "metadata": obj.get("metadata"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "banner": obj.get("banner"), + "name": obj.get("name"), + "campaign_name": obj.get("campaign_name"), + "campaign_id": obj.get("campaign_id"), + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "redeemables": [QualificationsRedeemableBase.from_dict(_item) for _item in obj["redeemables"]] if obj.get("redeemables") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_redeemable_base.py b/voucherify/models/qualifications_redeemable_base.py new file mode 100644 index 00000000..de34bf5f --- /dev/null +++ b/voucherify/models/qualifications_redeemable_base.py @@ -0,0 +1,205 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to_result_list import ApplicableToResultList +from voucherify.models.category import Category +from voucherify.models.inapplicable_to_result_list import InapplicableToResultList +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.redeemable_result import RedeemableResult +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsRedeemableBase(BaseModel): + """ + Data of single redeemable which was properly qualified. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Id of the redeemable.") + object: Optional[StrictStr] = Field(default=None, description="Object type of the redeemable.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.") + result: Optional[RedeemableResult] = None + order: Optional[OrderCalculated] = None + validation_rule_id: Optional[StrictStr] = Field(default=None, description="A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.") + applicable_to: Optional[ApplicableToResultList] = None + inapplicable_to: Optional[InapplicableToResultList] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.") + categories: Optional[List[Category]] = Field(default=None, description="List of category information.") + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + name: Optional[StrictStr] = Field(default=None, description="Name of the redeemable.") + campaign_name: Optional[StrictStr] = Field(default=None, description="Name of the campaign associated to the redeemable. This field is available only if object is not `campaign`") + campaign_id: Optional[StrictStr] = Field(default=None, description="Id of the campaign associated to the redeemable. This field is available only if object is not `campaign`") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "result", "order", "validation_rule_id", "applicable_to", "inapplicable_to", "metadata", "categories", "banner", "name", "campaign_name", "campaign_id", "validation_rules_assignments"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign', 'promotion_tier', 'promotion_stack', 'voucher']): + raise ValueError("must be one of enum values ('campaign', 'promotion_tier', 'promotion_stack', 'voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsRedeemableBase 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 result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of inapplicable_to + if self.inapplicable_to: + _dict['inapplicable_to'] = self.inapplicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if validation_rule_id (nullable) is None + # and model_fields_set contains the field + if self.validation_rule_id is None and "validation_rule_id" in self.model_fields_set: + _dict['validation_rule_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if campaign_name (nullable) is None + # and model_fields_set contains the field + if self.campaign_name is None and "campaign_name" in self.model_fields_set: + _dict['campaign_name'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsRedeemableBase 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"), + "object": obj.get("object"), + "created_at": obj.get("created_at"), + "result": RedeemableResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "validation_rule_id": obj.get("validation_rule_id"), + "applicable_to": ApplicableToResultList.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "inapplicable_to": InapplicableToResultList.from_dict(obj["inapplicable_to"]) if obj.get("inapplicable_to") is not None else None, + "metadata": obj.get("metadata"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "banner": obj.get("banner"), + "name": obj.get("name"), + "campaign_name": obj.get("campaign_name"), + "campaign_id": obj.get("campaign_id"), + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/qualifications_redeemables.py b/voucherify/models/qualifications_redeemables.py new file mode 100644 index 00000000..585c53d0 --- /dev/null +++ b/voucherify/models/qualifications_redeemables.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.qualifications_redeemable import QualificationsRedeemable +from typing import Optional, Set +from typing_extensions import Self + +class QualificationsRedeemables(BaseModel): + """ + List of redeemables for examine qualification. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. Default is `list`.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of qualified redeemables.") + data: Optional[List[QualificationsRedeemable]] = Field(default=None, description="Array of qualified redeemables.") + total: Optional[StrictInt] = Field(default=None, description="The number of redeemables returned in the API request.") + has_more: Optional[StrictBool] = Field(default=None, description="As results are always limited, the `has_more` flag indicates if there are more records for given parameters. This lets you know if you can run another request (with different options) to get more records returned in the results.") + more_starting_after: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time to use in `starting_after` cursor to get more redeemables.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total", "has_more", "more_starting_after"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of QualificationsRedeemables 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + # set to None if more_starting_after (nullable) is None + # and model_fields_set contains the field + if self.more_starting_after is None and "more_starting_after" in self.model_fields_set: + _dict['more_starting_after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of QualificationsRedeemables from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [QualificationsRedeemable.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total"), + "has_more": obj.get("has_more"), + "more_starting_after": obj.get("more_starting_after") + }) + return _obj + + diff --git a/voucherify/models/redeemable_gift.py b/voucherify/models/redeemable_gift.py new file mode 100644 index 00000000..bfb90956 --- /dev/null +++ b/voucherify/models/redeemable_gift.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class RedeemableGift(BaseModel): + """ + Contains current gift card balance information. + """ # noqa: E501 + balance: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + credits: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + __properties: ClassVar[List[str]] = ["balance", "credits"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableGift 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, + ) + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if credits (nullable) is None + # and model_fields_set contains the field + if self.credits is None and "credits" in self.model_fields_set: + _dict['credits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "balance": obj.get("balance"), + "credits": obj.get("credits") + }) + return _obj + + diff --git a/voucherify/models/redeemable_loyalty_card.py b/voucherify/models/redeemable_loyalty_card.py new file mode 100644 index 00000000..87d686c6 --- /dev/null +++ b/voucherify/models/redeemable_loyalty_card.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from voucherify.models.loyalties_transfer_points import LoyaltiesTransferPoints +from typing import Optional, Set +from typing_extensions import Self + +class RedeemableLoyaltyCard(BaseModel): + """ + Redeemable loyalty card object response + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + exchange_ratio: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The cash equivalent of the points defined in the points_ratio property.") + points_ratio: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property.") + transfers: Optional[List[LoyaltiesTransferPoints]] = None + __properties: ClassVar[List[str]] = ["points", "balance", "exchange_ratio", "points_ratio", "transfers"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableLoyaltyCard 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 transfers (list) + _items = [] + if self.transfers: + for _item_transfers in self.transfers: + if _item_transfers: + _items.append(_item_transfers.to_dict()) + _dict['transfers'] = _items + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if exchange_ratio (nullable) is None + # and model_fields_set contains the field + if self.exchange_ratio is None and "exchange_ratio" in self.model_fields_set: + _dict['exchange_ratio'] = None + + # set to None if points_ratio (nullable) is None + # and model_fields_set contains the field + if self.points_ratio is None and "points_ratio" in self.model_fields_set: + _dict['points_ratio'] = None + + # set to None if transfers (nullable) is None + # and model_fields_set contains the field + if self.transfers is None and "transfers" in self.model_fields_set: + _dict['transfers'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "exchange_ratio": obj.get("exchange_ratio"), + "points_ratio": obj.get("points_ratio"), + "transfers": [LoyaltiesTransferPoints.from_dict(_item) for _item in obj["transfers"]] if obj.get("transfers") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redeemable_result.py b/voucherify/models/redeemable_result.py new file mode 100644 index 00000000..be36c609 --- /dev/null +++ b/voucherify/models/redeemable_result.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from voucherify.models.error import Error +from voucherify.models.redeemable_gift import RedeemableGift +from voucherify.models.redeemable_loyalty_card import RedeemableLoyaltyCard +from typing import Optional, Set +from typing_extensions import Self + +class RedeemableResult(BaseModel): + """ + Information about redeemable result. + """ # noqa: E501 + discount: Optional[Discount] = None + gift: Optional[RedeemableGift] = None + loyalty_card: Optional[RedeemableLoyaltyCard] = None + error: Optional[Error] = None + __properties: ClassVar[List[str]] = ["discount", "gift", "loyalty_card", "error"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableResult 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": RedeemableGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedeemableLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "error": Error.from_dict(obj["error"]) if obj.get("error") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redeemable_voucher.py b/voucherify/models/redeemable_voucher.py new file mode 100644 index 00000000..f8f3ea61 --- /dev/null +++ b/voucherify/models/redeemable_voucher.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from voucherify.models.redeemable_voucher_gift import RedeemableVoucherGift +from voucherify.models.redeemable_voucher_loyalty_card import RedeemableVoucherLoyaltyCard +from voucherify.models.redeemable_voucher_publish import RedeemableVoucherPublish +from voucherify.models.redeemable_voucher_redemption import RedeemableVoucherRedemption +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class RedeemableVoucher(BaseModel): + """ + This is an object representing a voucher. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="The value is null.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + categories: Optional[List[Dict[str, Any]]] = Field(default=None, description="Contains an empty array.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[RedeemableVoucherGift] = None + loyalty_card: Optional[RedeemableVoucherLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[RedeemableVoucherPublish] = None + redemption: Optional[RedeemableVoucherRedemption] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "categories", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "referrer_id", "holder_id", "object", "publish", "redemption"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableVoucher 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "categories": obj.get("categories"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": RedeemableVoucherGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedeemableVoucherLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "referrer_id": obj.get("referrer_id"), + "holder_id": obj.get("holder_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": RedeemableVoucherPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": RedeemableVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redeemable_voucher_gift.py b/voucherify/models/redeemable_voucher_gift.py new file mode 100644 index 00000000..f8a1fa45 --- /dev/null +++ b/voucherify/models/redeemable_voucher_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class RedeemableVoucherGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableVoucherGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableVoucherGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/redeemable_voucher_loyalty_card.py b/voucherify/models/redeemable_voucher_loyalty_card.py new file mode 100644 index 00000000..1239e8c1 --- /dev/null +++ b/voucherify/models/redeemable_voucher_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedeemableVoucherLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableVoucherLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableVoucherLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/redeemable_voucher_publish.py b/voucherify/models/redeemable_voucher_publish.py new file mode 100644 index 00000000..5d44c605 --- /dev/null +++ b/voucherify/models/redeemable_voucher_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedeemableVoucherPublish(BaseModel): + """ + This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or [publish voucher](ref:create-publication) API method. | Required | Optional | | -------- | :------: | | `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | | `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` | + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableVoucherPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableVoucherPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redeemable_voucher_redemption.py b/voucherify/models/redeemable_voucher_redemption.py new file mode 100644 index 00000000..bfc168da --- /dev/null +++ b/voucherify/models/redeemable_voucher_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedeemableVoucherRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedeemableVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedeemableVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemption.py b/voucherify/models/redemption.py new file mode 100644 index 00000000..531dcbb0 --- /dev/null +++ b/voucherify/models/redemption.py @@ -0,0 +1,304 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated import OrderCalculated +from voucherify.models.promotion_tier import PromotionTier +from voucherify.models.redemption_channel import RedemptionChannel +from voucherify.models.redemption_gift import RedemptionGift +from voucherify.models.redemption_loyalty_card import RedemptionLoyaltyCard +from voucherify.models.redemption_related_redemptions import RedemptionRelatedRedemptions +from voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.redemption_voucher import RedemptionVoucher +from voucherify.models.simple_customer import SimpleCustomer +from typing import Optional, Set +from typing_extensions import Self + +class Redemption(BaseModel): + """ + This is an object representing a redemption. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + object: Optional[StrictStr] = Field(default='redemption', description="The type of the object represented by the JSON") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the redeeming customer.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the redemption.") + amount: Optional[StrictInt] = Field(default=None, description="For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction.") + redemption: Optional[StrictStr] = Field(default=None, description="Unique redemption ID of the parent redemption.") + result: Optional[StrictStr] = Field(default=None, description="Redemption result.") + status: Optional[StrictStr] = Field(default=None, description="Redemption status.") + related_redemptions: Optional[RedemptionRelatedRedemptions] = None + failure_code: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed.") + order: Optional[OrderCalculated] = None + channel: Optional[RedemptionChannel] = None + customer: Optional[SimpleCustomer] = None + related_object_type: Optional[StrictStr] = Field(default=None, description="Defines the related object.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher.") + voucher: Optional[RedemptionVoucher] = None + promotion_tier: Optional[PromotionTier] = None + reward: Optional[RedemptionRewardResult] = None + gift: Optional[RedemptionGift] = None + loyalty_card: Optional[RedemptionLoyaltyCard] = None + __properties: ClassVar[List[str]] = ["id", "object", "date", "customer_id", "tracking_id", "metadata", "amount", "redemption", "result", "status", "related_redemptions", "failure_code", "failure_message", "order", "channel", "customer", "related_object_type", "related_object_id", "voucher", "promotion_tier", "reward", "gift", "loyalty_card"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption']): + raise ValueError("must be one of enum values ('redemption')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCEEDED', 'FAILED', 'ROLLED_BACK']): + raise ValueError("must be one of enum values ('SUCCEEDED', 'FAILED', 'ROLLED_BACK')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'redemption']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'redemption')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Redemption 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 related_redemptions + if self.related_redemptions: + _dict['related_redemptions'] = self.related_redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of channel + if self.channel: + _dict['channel'] = self.channel.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion_tier + if self.promotion_tier: + _dict['promotion_tier'] = self.promotion_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if var_date (nullable) is None + # and model_fields_set contains the field + if self.var_date is None and "var_date" in self.model_fields_set: + _dict['date'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if related_redemptions (nullable) is None + # and model_fields_set contains the field + if self.related_redemptions is None and "related_redemptions" in self.model_fields_set: + _dict['related_redemptions'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if voucher (nullable) is None + # and model_fields_set contains the field + if self.voucher is None and "voucher" in self.model_fields_set: + _dict['voucher'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Redemption 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"), + "object": obj.get("object") if obj.get("object") is not None else 'redemption', + "date": obj.get("date"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "amount": obj.get("amount"), + "redemption": obj.get("redemption"), + "result": obj.get("result"), + "status": obj.get("status"), + "related_redemptions": RedemptionRelatedRedemptions.from_dict(obj["related_redemptions"]) if obj.get("related_redemptions") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "channel": RedemptionChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, + "customer": SimpleCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "related_object_type": obj.get("related_object_type"), + "related_object_id": obj.get("related_object_id"), + "voucher": RedemptionVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "promotion_tier": PromotionTier.from_dict(obj["promotion_tier"]) if obj.get("promotion_tier") is not None else None, + "reward": RedemptionRewardResult.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "gift": RedemptionGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_channel.py b/voucherify/models/redemption_channel.py new file mode 100644 index 00000000..38cb0f18 --- /dev/null +++ b/voucherify/models/redemption_channel.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionChannel(BaseModel): + """ + Defines the details of the channel through which the redemption was issued. + """ # noqa: E501 + channel_id: Optional[StrictStr] = Field(default=None, description="Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API.") + channel_type: Optional[StrictStr] = Field(default=None, description="The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.") + __properties: ClassVar[List[str]] = ["channel_id", "channel_type"] + + @field_validator('channel_type') + def channel_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['USER', 'API']): + raise ValueError("must be one of enum values ('USER', 'API')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionChannel 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, + ) + # set to None if channel_id (nullable) is None + # and model_fields_set contains the field + if self.channel_id is None and "channel_id" in self.model_fields_set: + _dict['channel_id'] = None + + # set to None if channel_type (nullable) is None + # and model_fields_set contains the field + if self.channel_type is None and "channel_type" in self.model_fields_set: + _dict['channel_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionChannel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel_id": obj.get("channel_id"), + "channel_type": obj.get("channel_type") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry.py b/voucherify/models/redemption_entry.py new file mode 100644 index 00000000..a954487f --- /dev/null +++ b/voucherify/models/redemption_entry.py @@ -0,0 +1,326 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.redemption_entry_channel import RedemptionEntryChannel +from voucherify.models.redemption_entry_customer import RedemptionEntryCustomer +from voucherify.models.redemption_entry_gift import RedemptionEntryGift +from voucherify.models.redemption_entry_loyalty_card import RedemptionEntryLoyaltyCard +from voucherify.models.redemption_entry_order import RedemptionEntryOrder +from voucherify.models.redemption_entry_promotion_tier import RedemptionEntryPromotionTier +from voucherify.models.redemption_entry_related_redemptions import RedemptionEntryRelatedRedemptions +from voucherify.models.redemption_entry_voucher import RedemptionEntryVoucher +from voucherify.models.redemption_reward_result import RedemptionRewardResult +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntry(BaseModel): + """ + RedemptionEntry + """ # noqa: E501 + id: Optional[StrictStr] = None + object: Optional[StrictStr] = None + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the redeeming customer.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + metadata: Optional[Dict[str, Any]] = None + amount: Optional[StrictInt] = Field(default=None, description="For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer.") + redemption: Optional[StrictStr] = Field(default=None, description="Unique redemption ID of the parent redemption.") + result: Optional[StrictStr] = Field(default=None, description="Redemption result.") + status: Optional[StrictStr] = None + related_redemptions: Optional[RedemptionEntryRelatedRedemptions] = None + failure_code: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed.") + order: Optional[RedemptionEntryOrder] = None + channel: Optional[RedemptionEntryChannel] = None + customer: Optional[RedemptionEntryCustomer] = None + related_object_type: Optional[StrictStr] = Field(default=None, description="Defines the related object.") + related_object_id: Optional[StrictStr] = None + voucher: Optional[RedemptionEntryVoucher] = None + promotion_tier: Optional[RedemptionEntryPromotionTier] = None + reward: Optional[RedemptionRewardResult] = None + gift: Optional[RedemptionEntryGift] = None + loyalty_card: Optional[RedemptionEntryLoyaltyCard] = None + reason: Optional[StrictStr] = Field(default=None, description="System generated cause for the redemption being invalid in the context of the provided parameters.") + __properties: ClassVar[List[str]] = ["id", "object", "date", "customer_id", "tracking_id", "metadata", "amount", "redemption", "result", "status", "related_redemptions", "failure_code", "failure_message", "order", "channel", "customer", "related_object_type", "related_object_id", "voucher", "promotion_tier", "reward", "gift", "loyalty_card", "reason"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption', 'redemption_rollback']): + raise ValueError("must be one of enum values ('redemption', 'redemption_rollback')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCEEDED', 'FAILED', 'ROLLED_BACK']): + raise ValueError("must be one of enum values ('SUCCEEDED', 'FAILED', 'ROLLED_BACK')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'redemption']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'redemption')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntry 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 related_redemptions + if self.related_redemptions: + _dict['related_redemptions'] = self.related_redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of channel + if self.channel: + _dict['channel'] = self.channel.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion_tier + if self.promotion_tier: + _dict['promotion_tier'] = self.promotion_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if var_date (nullable) is None + # and model_fields_set contains the field + if self.var_date is None and "var_date" in self.model_fields_set: + _dict['date'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if related_redemptions (nullable) is None + # and model_fields_set contains the field + if self.related_redemptions is None and "related_redemptions" in self.model_fields_set: + _dict['related_redemptions'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if voucher (nullable) is None + # and model_fields_set contains the field + if self.voucher is None and "voucher" in self.model_fields_set: + _dict['voucher'] = None + + # set to None if promotion_tier (nullable) is None + # and model_fields_set contains the field + if self.promotion_tier is None and "promotion_tier" in self.model_fields_set: + _dict['promotion_tier'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntry 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"), + "object": obj.get("object"), + "date": obj.get("date"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "amount": obj.get("amount"), + "redemption": obj.get("redemption"), + "result": obj.get("result"), + "status": obj.get("status"), + "related_redemptions": RedemptionEntryRelatedRedemptions.from_dict(obj["related_redemptions"]) if obj.get("related_redemptions") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message"), + "order": RedemptionEntryOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "channel": RedemptionEntryChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, + "customer": RedemptionEntryCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "related_object_type": obj.get("related_object_type"), + "related_object_id": obj.get("related_object_id"), + "voucher": RedemptionEntryVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "promotion_tier": RedemptionEntryPromotionTier.from_dict(obj["promotion_tier"]) if obj.get("promotion_tier") is not None else None, + "reward": RedemptionRewardResult.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "gift": RedemptionEntryGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionEntryLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "reason": obj.get("reason") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_channel.py b/voucherify/models/redemption_entry_channel.py new file mode 100644 index 00000000..536b9782 --- /dev/null +++ b/voucherify/models/redemption_entry_channel.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionEntryChannel(BaseModel): + """ + RedemptionEntryChannel + """ # noqa: E501 + channel_id: Optional[StrictStr] = None + channel_type: Optional[StrictStr] = Field(default=None, description="The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.") + __properties: ClassVar[List[str]] = ["channel_id", "channel_type"] + + @field_validator('channel_type') + def channel_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['USER', 'API']): + raise ValueError("must be one of enum values ('USER', 'API')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryChannel 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, + ) + # set to None if channel_id (nullable) is None + # and model_fields_set contains the field + if self.channel_id is None and "channel_id" in self.model_fields_set: + _dict['channel_id'] = None + + # set to None if channel_type (nullable) is None + # and model_fields_set contains the field + if self.channel_type is None and "channel_type" in self.model_fields_set: + _dict['channel_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryChannel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel_id": obj.get("channel_id"), + "channel_type": obj.get("channel_type") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_customer.py b/voucherify/models/redemption_entry_customer.py new file mode 100644 index 00000000..457e1607 --- /dev/null +++ b/voucherify/models/redemption_entry_customer.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionEntryCustomer(BaseModel): + """ + RedemptionEntryCustomer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of an existing customer. It is assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service.") + metadata: Optional[Dict[str, Any]] = None + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "name", "email", "source_id", "metadata", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryCustomer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryCustomer 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"), + "name": obj.get("name"), + "email": obj.get("email"), + "source_id": obj.get("source_id"), + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_gift.py b/voucherify/models/redemption_entry_gift.py new file mode 100644 index 00000000..9537e6bf --- /dev/null +++ b/voucherify/models/redemption_entry_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryGift(BaseModel): + """ + RedemptionEntryGift + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned).") + __properties: ClassVar[List[str]] = ["amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_loyalty_card.py b/voucherify/models/redemption_entry_loyalty_card.py new file mode 100644 index 00000000..35cc6772 --- /dev/null +++ b/voucherify/models/redemption_entry_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryLoyaltyCard(BaseModel): + """ + RedemptionEntryLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_order.py b/voucherify/models/redemption_entry_order.py new file mode 100644 index 00000000..95c9a3b5 --- /dev/null +++ b/voucherify/models/redemption_entry_order.py @@ -0,0 +1,277 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.redemption_entry_order_customer import RedemptionEntryOrderCustomer +from voucherify.models.redemption_entry_order_referrer import RedemptionEntryOrderReferrer +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryOrder(BaseModel): + """ + RedemptionEntryOrder + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied to the order.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied to the order.") + total_amount: Optional[StrictInt] = Field(default=None, description="Order amount after undoing all the discounts through the rollback redemption.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + items_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)`") + total_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`") + items: Optional[List[OrderCalculatedItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = None + object: Optional[StrictStr] = Field(default='order', description="The type of the object represented by JSON.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was last updated in ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[RedemptionEntryOrderCustomer] = None + referrer: Optional[RedemptionEntryOrderReferrer] = None + redemptions: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items_discount_amount", "total_discount_amount", "total_amount", "applied_discount_amount", "items_applied_discount_amount", "total_applied_discount_amount", "items", "metadata", "object", "created_at", "updated_at", "customer_id", "referrer_id", "customer", "referrer", "redemptions"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryOrder 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_discount_amount is None and "items_discount_amount" in self.model_fields_set: + _dict['items_discount_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if items_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_applied_discount_amount is None and "items_applied_discount_amount" in self.model_fields_set: + _dict['items_applied_discount_amount'] = None + + # set to None if total_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_applied_discount_amount is None and "total_applied_discount_amount" in self.model_fields_set: + _dict['total_applied_discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if referrer (nullable) is None + # and model_fields_set contains the field + if self.referrer is None and "referrer" in self.model_fields_set: + _dict['referrer'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryOrder 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items_discount_amount": obj.get("items_discount_amount"), + "total_discount_amount": obj.get("total_discount_amount"), + "total_amount": obj.get("total_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "items_applied_discount_amount": obj.get("items_applied_discount_amount"), + "total_applied_discount_amount": obj.get("total_applied_discount_amount"), + "items": [OrderCalculatedItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'order', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "customer_id": obj.get("customer_id"), + "referrer_id": obj.get("referrer_id"), + "customer": RedemptionEntryOrderCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": RedemptionEntryOrderReferrer.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None, + "redemptions": obj.get("redemptions") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_order_customer.py b/voucherify/models/redemption_entry_order_customer.py new file mode 100644 index 00000000..13948d58 --- /dev/null +++ b/voucherify/models/redemption_entry_order_customer.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionEntryOrderCustomer(BaseModel): + """ + RedemptionEntryOrderCustomer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryOrderCustomer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryOrderCustomer 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_order_referrer.py b/voucherify/models/redemption_entry_order_referrer.py new file mode 100644 index 00000000..4812099f --- /dev/null +++ b/voucherify/models/redemption_entry_order_referrer.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionEntryOrderReferrer(BaseModel): + """ + RedemptionEntryOrderReferrer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryOrderReferrer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryOrderReferrer 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_promotion_tier.py b/voucherify/models/redemption_entry_promotion_tier.py new file mode 100644 index 00000000..1d916e3b --- /dev/null +++ b/voucherify/models/redemption_entry_promotion_tier.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.redemption_entry_promotion_tier_action import RedemptionEntryPromotionTierAction +from voucherify.models.redemption_entry_promotion_tier_campaign import RedemptionEntryPromotionTierCampaign +from voucherify.models.redemption_entry_promotion_tier_summary import RedemptionEntryPromotionTierSummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryPromotionTier(BaseModel): + """ + RedemptionEntryPromotionTier + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[RedemptionEntryPromotionTierAction] = None + metadata: Optional[Dict[str, Any]] = None + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[RedemptionEntryPromotionTierCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[RedemptionEntryPromotionTierSummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTier 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTier 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": RedemptionEntryPromotionTierAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": RedemptionEntryPromotionTierCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": RedemptionEntryPromotionTierSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_promotion_tier_action.py b/voucherify/models/redemption_entry_promotion_tier_action.py new file mode 100644 index 00000000..d80560ee --- /dev/null +++ b/voucherify/models/redemption_entry_promotion_tier_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryPromotionTierAction(BaseModel): + """ + RedemptionEntryPromotionTierAction + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_promotion_tier_campaign.py b/voucherify/models/redemption_entry_promotion_tier_campaign.py new file mode 100644 index 00000000..81f57cda --- /dev/null +++ b/voucherify/models/redemption_entry_promotion_tier_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryPromotionTierCampaign(BaseModel): + """ + RedemptionEntryPromotionTierCampaign + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_promotion_tier_summary.py b/voucherify/models/redemption_entry_promotion_tier_summary.py new file mode 100644 index 00000000..802082be --- /dev/null +++ b/voucherify/models/redemption_entry_promotion_tier_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemption_entry_promotion_tier_summary_orders import RedemptionEntryPromotionTierSummaryOrders +from voucherify.models.redemption_entry_promotion_tier_summary_redemptions import RedemptionEntryPromotionTierSummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryPromotionTierSummary(BaseModel): + """ + RedemptionEntryPromotionTierSummary + """ # noqa: E501 + redemptions: Optional[RedemptionEntryPromotionTierSummaryRedemptions] = None + orders: Optional[RedemptionEntryPromotionTierSummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierSummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": RedemptionEntryPromotionTierSummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": RedemptionEntryPromotionTierSummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_promotion_tier_summary_orders.py b/voucherify/models/redemption_entry_promotion_tier_summary_orders.py new file mode 100644 index 00000000..c036b9aa --- /dev/null +++ b/voucherify/models/redemption_entry_promotion_tier_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryPromotionTierSummaryOrders(BaseModel): + """ + RedemptionEntryPromotionTierSummaryOrders + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierSummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierSummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_promotion_tier_summary_redemptions.py b/voucherify/models/redemption_entry_promotion_tier_summary_redemptions.py new file mode 100644 index 00000000..2b2fe864 --- /dev/null +++ b/voucherify/models/redemption_entry_promotion_tier_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryPromotionTierSummaryRedemptions(BaseModel): + """ + RedemptionEntryPromotionTierSummaryRedemptions + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierSummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryPromotionTierSummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_related_redemptions.py b/voucherify/models/redemption_entry_related_redemptions.py new file mode 100644 index 00000000..8447a916 --- /dev/null +++ b/voucherify/models/redemption_entry_related_redemptions.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemption_entry_related_redemptions_redemptions_item import RedemptionEntryRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_entry_related_redemptions_rollbacks_item import RedemptionEntryRelatedRedemptionsRollbacksItem +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryRelatedRedemptions(BaseModel): + """ + RedemptionEntryRelatedRedemptions + """ # noqa: E501 + rollbacks: Optional[List[RedemptionEntryRelatedRedemptionsRollbacksItem]] = None + redemptions: Optional[List[RedemptionEntryRelatedRedemptionsRedemptionsItem]] = None + __properties: ClassVar[List[str]] = ["rollbacks", "redemptions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryRelatedRedemptions 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if rollbacks (nullable) is None + # and model_fields_set contains the field + if self.rollbacks is None and "rollbacks" in self.model_fields_set: + _dict['rollbacks'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryRelatedRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [RedemptionEntryRelatedRedemptionsRollbacksItem.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "redemptions": [RedemptionEntryRelatedRedemptionsRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_related_redemptions_redemptions_item.py b/voucherify/models/redemption_entry_related_redemptions_redemptions_item.py new file mode 100644 index 00000000..a43f0a61 --- /dev/null +++ b/voucherify/models/redemption_entry_related_redemptions_redemptions_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryRelatedRedemptionsRedemptionsItem(BaseModel): + """ + RedemptionEntryRelatedRedemptionsRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryRelatedRedemptionsRedemptionsItem 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 RedemptionEntryRelatedRedemptionsRedemptionsItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_related_redemptions_rollbacks_item.py b/voucherify/models/redemption_entry_related_redemptions_rollbacks_item.py new file mode 100644 index 00000000..41ca7bfd --- /dev/null +++ b/voucherify/models/redemption_entry_related_redemptions_rollbacks_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryRelatedRedemptionsRollbacksItem(BaseModel): + """ + RedemptionEntryRelatedRedemptionsRollbacksItem + """ # noqa: E501 + id: Optional[StrictStr] = None + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryRelatedRedemptionsRollbacksItem 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 RedemptionEntryRelatedRedemptionsRollbacksItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_voucher.py b/voucherify/models/redemption_entry_voucher.py new file mode 100644 index 00000000..3d78842d --- /dev/null +++ b/voucherify/models/redemption_entry_voucher.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.redemption_entry_voucher_gift import RedemptionEntryVoucherGift +from voucherify.models.redemption_entry_voucher_loyalty_card import RedemptionEntryVoucherLoyaltyCard +from voucherify.models.redemption_entry_voucher_publish import RedemptionEntryVoucherPublish +from voucherify.models.redemption_entry_voucher_redemption import RedemptionEntryVoucherRedemption +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryVoucher(BaseModel): + """ + RedemptionEntryVoucher + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[RedemptionEntryVoucherGift] = None + loyalty_card: Optional[RedemptionEntryVoucherLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = None + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[RedemptionEntryVoucherPublish] = None + redemption: Optional[RedemptionEntryVoucherRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + holder: Optional[SimpleCustomer] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments", "holder"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of holder + if self.holder: + _dict['holder'] = self.holder.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucher 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": RedemptionEntryVoucherGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionEntryVoucherLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": RedemptionEntryVoucherPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": RedemptionEntryVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "holder": SimpleCustomer.from_dict(obj["holder"]) if obj.get("holder") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_voucher_gift.py b/voucherify/models/redemption_entry_voucher_gift.py new file mode 100644 index 00000000..ae546544 --- /dev/null +++ b/voucherify/models/redemption_entry_voucher_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class RedemptionEntryVoucherGift(BaseModel): + """ + RedemptionEntryVoucherGift + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_voucher_loyalty_card.py b/voucherify/models/redemption_entry_voucher_loyalty_card.py new file mode 100644 index 00000000..c6f1d87d --- /dev/null +++ b/voucherify/models/redemption_entry_voucher_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryVoucherLoyaltyCard(BaseModel): + """ + RedemptionEntryVoucherLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_voucher_publish.py b/voucherify/models/redemption_entry_voucher_publish.py new file mode 100644 index 00000000..4e11e77b --- /dev/null +++ b/voucherify/models/redemption_entry_voucher_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryVoucherPublish(BaseModel): + """ + RedemptionEntryVoucherPublish + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemption_entry_voucher_redemption.py b/voucherify/models/redemption_entry_voucher_redemption.py new file mode 100644 index 00000000..526b1bf5 --- /dev/null +++ b/voucherify/models/redemption_entry_voucher_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionEntryVoucherRedemption(BaseModel): + """ + RedemptionEntryVoucherRedemption + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionEntryVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemption_gift.py b/voucherify/models/redemption_gift.py new file mode 100644 index 00000000..1f9d0b8f --- /dev/null +++ b/voucherify/models/redemption_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionGift(BaseModel): + """ + Contains the amount subtracted from the gift card for the redemption. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/redemption_loyalty_card.py b/voucherify/models/redemption_loyalty_card.py new file mode 100644 index 00000000..b8e6d9a4 --- /dev/null +++ b/voucherify/models/redemption_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionLoyaltyCard(BaseModel): + """ + Contains the number of points subtracted from the loyalty card for the redemption. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points subtracted from the loyalty card as a result of the redemption.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/redemption_related_redemptions.py b/voucherify/models/redemption_related_redemptions.py new file mode 100644 index 00000000..df905261 --- /dev/null +++ b/voucherify/models/redemption_related_redemptions.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemption_related_redemptions_redemptions_item import RedemptionRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_related_redemptions_rollbacks_item import RedemptionRelatedRedemptionsRollbacksItem +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRelatedRedemptions(BaseModel): + """ + RedemptionRelatedRedemptions + """ # noqa: E501 + rollbacks: Optional[List[RedemptionRelatedRedemptionsRollbacksItem]] = None + redemptions: Optional[List[RedemptionRelatedRedemptionsRedemptionsItem]] = None + __properties: ClassVar[List[str]] = ["rollbacks", "redemptions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRelatedRedemptions 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if rollbacks (nullable) is None + # and model_fields_set contains the field + if self.rollbacks is None and "rollbacks" in self.model_fields_set: + _dict['rollbacks'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRelatedRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [RedemptionRelatedRedemptionsRollbacksItem.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "redemptions": [RedemptionRelatedRedemptionsRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_related_redemptions_redemptions_item.py b/voucherify/models/redemption_related_redemptions_redemptions_item.py new file mode 100644 index 00000000..69757a65 --- /dev/null +++ b/voucherify/models/redemption_related_redemptions_redemptions_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRelatedRedemptionsRedemptionsItem(BaseModel): + """ + RedemptionRelatedRedemptionsRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRelatedRedemptionsRedemptionsItem 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 RedemptionRelatedRedemptionsRedemptionsItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemption_related_redemptions_rollbacks_item.py b/voucherify/models/redemption_related_redemptions_rollbacks_item.py new file mode 100644 index 00000000..2e291025 --- /dev/null +++ b/voucherify/models/redemption_related_redemptions_rollbacks_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRelatedRedemptionsRollbacksItem(BaseModel): + """ + RedemptionRelatedRedemptionsRollbacksItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique rollback redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRelatedRedemptionsRollbacksItem 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 RedemptionRelatedRedemptionsRollbacksItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemption_reward_result.py b/voucherify/models/redemption_reward_result.py new file mode 100644 index 00000000..1679adfc --- /dev/null +++ b/voucherify/models/redemption_reward_result.py @@ -0,0 +1,205 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.product import Product +from voucherify.models.redemption_reward_result_parameters import RedemptionRewardResultParameters +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.sku import Sku +from voucherify.models.voucher import Voucher +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRewardResult(BaseModel): + """ + RedemptionRewardResult + """ # noqa: E501 + customer: Optional[SimpleCustomer] = None + assignment_id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID assigned by Voucherify.") + voucher: Optional[Voucher] = None + product: Optional[Product] = None + sku: Optional[Sku] = None + loyalty_tier_id: Optional[StrictStr] = Field(default=None, description="Unique loyalty tier ID assigned by Voucherify.") + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID.") + name: Optional[StrictStr] = Field(default=None, description="Name of the reward.") + object: Optional[StrictStr] = Field(default='reward', description="The type of the object represented by the JSON") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the redemption was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp in ISO 8601 format indicating when the reward was updated.") + parameters: Optional[RedemptionRewardResultParameters] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a reward. The metadata object stores all custom attributes assigned to the reward.") + type: Optional[StrictStr] = Field(default=None, description="Reward type.") + __properties: ClassVar[List[str]] = ["customer", "assignment_id", "voucher", "product", "sku", "loyalty_tier_id", "id", "name", "object", "created_at", "updated_at", "parameters", "metadata", "type"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward']): + raise ValueError("must be one of enum values ('reward')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CAMPAIGN', 'COIN', 'MATERIAL']): + raise ValueError("must be one of enum values ('CAMPAIGN', 'COIN', 'MATERIAL')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRewardResult 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of sku + if self.sku: + _dict['sku'] = self.sku.to_dict() + # override the default output from pydantic by calling `to_dict()` of parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if assignment_id (nullable) is None + # and model_fields_set contains the field + if self.assignment_id is None and "assignment_id" in self.model_fields_set: + _dict['assignment_id'] = None + + # set to None if loyalty_tier_id (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier_id is None and "loyalty_tier_id" in self.model_fields_set: + _dict['loyalty_tier_id'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRewardResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "customer": SimpleCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "assignment_id": obj.get("assignment_id"), + "voucher": Voucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "product": Product.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sku": Sku.from_dict(obj["sku"]) if obj.get("sku") is not None else None, + "loyalty_tier_id": obj.get("loyalty_tier_id"), + "id": obj.get("id"), + "name": obj.get("name"), + "object": obj.get("object") if obj.get("object") is not None else 'reward', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "parameters": RedemptionRewardResultParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "metadata": obj.get("metadata"), + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/redemption_reward_result_parameters.py b/voucherify/models/redemption_reward_result_parameters.py new file mode 100644 index 00000000..82134695 --- /dev/null +++ b/voucherify/models/redemption_reward_result_parameters.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemption_reward_result_parameters_campaign import RedemptionRewardResultParametersCampaign +from voucherify.models.redemption_reward_result_parameters_coin import RedemptionRewardResultParametersCoin +from voucherify.models.redemption_reward_result_parameters_product import RedemptionRewardResultParametersProduct +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRewardResultParameters(BaseModel): + """ + These are parameters representing a material reward. + """ # noqa: E501 + campaign: Optional[RedemptionRewardResultParametersCampaign] = None + product: Optional[RedemptionRewardResultParametersProduct] = None + coin: Optional[RedemptionRewardResultParametersCoin] = None + __properties: ClassVar[List[str]] = ["campaign", "product", "coin"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParameters 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 campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of coin + if self.coin: + _dict['coin'] = self.coin.to_dict() + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if product (nullable) is None + # and model_fields_set contains the field + if self.product is None and "product" in self.model_fields_set: + _dict['product'] = None + + # set to None if coin (nullable) is None + # and model_fields_set contains the field + if self.coin is None and "coin" in self.model_fields_set: + _dict['coin'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "campaign": RedemptionRewardResultParametersCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "product": RedemptionRewardResultParametersProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, + "coin": RedemptionRewardResultParametersCoin.from_dict(obj["coin"]) if obj.get("coin") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_reward_result_parameters_campaign.py b/voucherify/models/redemption_reward_result_parameters_campaign.py new file mode 100644 index 00000000..f4ce32d4 --- /dev/null +++ b/voucherify/models/redemption_reward_result_parameters_campaign.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRewardResultParametersCampaign(BaseModel): + """ + Defines the product redeemed as a reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Campaign unique ID.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the campaign.") + __properties: ClassVar[List[str]] = ["id", "balance", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParametersCampaign 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParametersCampaign 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"), + "balance": obj.get("balance"), + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/redemption_reward_result_parameters_coin.py b/voucherify/models/redemption_reward_result_parameters_coin.py new file mode 100644 index 00000000..453dab3d --- /dev/null +++ b/voucherify/models/redemption_reward_result_parameters_coin.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRewardResultParametersCoin(BaseModel): + """ + Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + """ # noqa: E501 + exchange_ratio: Optional[StrictInt] = Field(default=None, description="The cash equivalent of the points defined in the `points_ratio` property.") + points_ratio: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property.") + __properties: ClassVar[List[str]] = ["exchange_ratio", "points_ratio"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParametersCoin 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, + ) + # set to None if exchange_ratio (nullable) is None + # and model_fields_set contains the field + if self.exchange_ratio is None and "exchange_ratio" in self.model_fields_set: + _dict['exchange_ratio'] = None + + # set to None if points_ratio (nullable) is None + # and model_fields_set contains the field + if self.points_ratio is None and "points_ratio" in self.model_fields_set: + _dict['points_ratio'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParametersCoin from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "exchange_ratio": obj.get("exchange_ratio"), + "points_ratio": obj.get("points_ratio") + }) + return _obj + + diff --git a/voucherify/models/redemption_reward_result_parameters_product.py b/voucherify/models/redemption_reward_result_parameters_product.py new file mode 100644 index 00000000..d6d99e45 --- /dev/null +++ b/voucherify/models/redemption_reward_result_parameters_product.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRewardResultParametersProduct(BaseModel): + """ + Defines the product redeemed as a reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID, assigned by Voucherify. ") + sku_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the SKU. It is assigned by Voucherify.") + __properties: ClassVar[List[str]] = ["id", "sku_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParametersProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if sku_id (nullable) is None + # and model_fields_set contains the field + if self.sku_id is None and "sku_id" in self.model_fields_set: + _dict['sku_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRewardResultParametersProduct 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"), + "sku_id": obj.get("sku_id") + }) + return _obj + + diff --git a/voucherify/models/redemption_rollback.py b/voucherify/models/redemption_rollback.py new file mode 100644 index 00000000..706b3df3 --- /dev/null +++ b/voucherify/models/redemption_rollback.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated import OrderCalculated +from voucherify.models.promotion_tier import PromotionTier +from voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.redemption_rollback_channel import RedemptionRollbackChannel +from voucherify.models.redemption_rollback_gift import RedemptionRollbackGift +from voucherify.models.redemption_rollback_loyalty_card import RedemptionRollbackLoyaltyCard +from voucherify.models.redemption_rollback_related_redemptions import RedemptionRollbackRelatedRedemptions +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.voucher import Voucher +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRollback(BaseModel): + """ + This is an object representing a redemption rollback. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the redemption rollback.") + object: Optional[StrictStr] = Field(default='redemption_rollback', description="The type of the object represented by the JSON") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the redeeming customer.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the redemption.") + amount: Optional[StrictInt] = Field(default=None, description="For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer.") + redemption: Optional[StrictStr] = Field(default=None, description="Unique redemption ID of the parent redemption.") + reason: Optional[StrictStr] = Field(default=None, description="System generated cause for the redemption being invalid in the context of the provided parameters.") + result: Optional[StrictStr] = Field(default=None, description="Redemption result.") + status: Optional[StrictStr] = Field(default=None, description="Redemption status.") + related_redemptions: Optional[RedemptionRollbackRelatedRedemptions] = None + failure_code: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed.") + order: Optional[OrderCalculated] = None + channel: Optional[RedemptionRollbackChannel] = None + customer: Optional[SimpleCustomer] = None + related_object_type: Optional[StrictStr] = Field(default=None, description="Defines the related object.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher.") + voucher: Optional[Voucher] = None + promotion_tier: Optional[PromotionTier] = None + reward: Optional[RedemptionRewardResult] = None + gift: Optional[RedemptionRollbackGift] = None + loyalty_card: Optional[RedemptionRollbackLoyaltyCard] = None + __properties: ClassVar[List[str]] = ["id", "object", "date", "customer_id", "tracking_id", "metadata", "amount", "redemption", "reason", "result", "status", "related_redemptions", "failure_code", "failure_message", "order", "channel", "customer", "related_object_type", "related_object_id", "voucher", "promotion_tier", "reward", "gift", "loyalty_card"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption_rollback']): + raise ValueError("must be one of enum values ('redemption_rollback')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCEEDED', 'FAILED']): + raise ValueError("must be one of enum values ('SUCCEEDED', 'FAILED')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'redemption']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'redemption')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRollback 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 related_redemptions + if self.related_redemptions: + _dict['related_redemptions'] = self.related_redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of channel + if self.channel: + _dict['channel'] = self.channel.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion_tier + if self.promotion_tier: + _dict['promotion_tier'] = self.promotion_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if var_date (nullable) is None + # and model_fields_set contains the field + if self.var_date is None and "var_date" in self.model_fields_set: + _dict['date'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if related_redemptions (nullable) is None + # and model_fields_set contains the field + if self.related_redemptions is None and "related_redemptions" in self.model_fields_set: + _dict['related_redemptions'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRollback 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"), + "object": obj.get("object") if obj.get("object") is not None else 'redemption_rollback', + "date": obj.get("date"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "amount": obj.get("amount"), + "redemption": obj.get("redemption"), + "reason": obj.get("reason"), + "result": obj.get("result"), + "status": obj.get("status"), + "related_redemptions": RedemptionRollbackRelatedRedemptions.from_dict(obj["related_redemptions"]) if obj.get("related_redemptions") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "channel": RedemptionRollbackChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, + "customer": SimpleCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "related_object_type": obj.get("related_object_type"), + "related_object_id": obj.get("related_object_id"), + "voucher": Voucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "promotion_tier": PromotionTier.from_dict(obj["promotion_tier"]) if obj.get("promotion_tier") is not None else None, + "reward": RedemptionRewardResult.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "gift": RedemptionRollbackGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionRollbackLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_rollback_channel.py b/voucherify/models/redemption_rollback_channel.py new file mode 100644 index 00000000..c7fb5cba --- /dev/null +++ b/voucherify/models/redemption_rollback_channel.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionRollbackChannel(BaseModel): + """ + Defines the details of the channel through which the redemption was issued. + """ # noqa: E501 + channel_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API.") + channel_type: Optional[StrictStr] = Field(default=None, description="The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.") + __properties: ClassVar[List[str]] = ["channel_id", "channel_type"] + + @field_validator('channel_type') + def channel_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['USER', 'API']): + raise ValueError("must be one of enum values ('USER', 'API')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRollbackChannel 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, + ) + # set to None if channel_id (nullable) is None + # and model_fields_set contains the field + if self.channel_id is None and "channel_id" in self.model_fields_set: + _dict['channel_id'] = None + + # set to None if channel_type (nullable) is None + # and model_fields_set contains the field + if self.channel_type is None and "channel_type" in self.model_fields_set: + _dict['channel_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRollbackChannel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel_id": obj.get("channel_id"), + "channel_type": obj.get("channel_type") + }) + return _obj + + diff --git a/voucherify/models/redemption_rollback_gift.py b/voucherify/models/redemption_rollback_gift.py new file mode 100644 index 00000000..78fe7e45 --- /dev/null +++ b/voucherify/models/redemption_rollback_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRollbackGift(BaseModel): + """ + Contains the amount returned to the gift card in the redemption rollback. It is expressed as a negative integer. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned).") + __properties: ClassVar[List[str]] = ["amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRollbackGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRollbackGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/redemption_rollback_loyalty_card.py b/voucherify/models/redemption_rollback_loyalty_card.py new file mode 100644 index 00000000..c35e09e4 --- /dev/null +++ b/voucherify/models/redemption_rollback_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRollbackLoyaltyCard(BaseModel): + """ + Contains the number of points returned to the loyalty card in the reward redemption rollback. It is expressed as a negative integer. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRollbackLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRollbackLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/redemption_rollback_related_redemptions.py b/voucherify/models/redemption_rollback_related_redemptions.py new file mode 100644 index 00000000..95ab9558 --- /dev/null +++ b/voucherify/models/redemption_rollback_related_redemptions.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemption_rollback_related_redemptions_redemptions_item import RedemptionRollbackRelatedRedemptionsRedemptionsItem +from voucherify.models.redemption_rollback_related_redemptions_rollbacks_item import RedemptionRollbackRelatedRedemptionsRollbacksItem +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRollbackRelatedRedemptions(BaseModel): + """ + RedemptionRollbackRelatedRedemptions + """ # noqa: E501 + rollbacks: Optional[List[RedemptionRollbackRelatedRedemptionsRollbacksItem]] = None + redemptions: Optional[List[RedemptionRollbackRelatedRedemptionsRedemptionsItem]] = None + __properties: ClassVar[List[str]] = ["rollbacks", "redemptions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRollbackRelatedRedemptions 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if rollbacks (nullable) is None + # and model_fields_set contains the field + if self.rollbacks is None and "rollbacks" in self.model_fields_set: + _dict['rollbacks'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionRollbackRelatedRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [RedemptionRollbackRelatedRedemptionsRollbacksItem.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "redemptions": [RedemptionRollbackRelatedRedemptionsRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_rollback_related_redemptions_redemptions_item.py b/voucherify/models/redemption_rollback_related_redemptions_redemptions_item.py new file mode 100644 index 00000000..55e96423 --- /dev/null +++ b/voucherify/models/redemption_rollback_related_redemptions_redemptions_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRollbackRelatedRedemptionsRedemptionsItem(BaseModel): + """ + RedemptionRollbackRelatedRedemptionsRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRollbackRelatedRedemptionsRedemptionsItem 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 RedemptionRollbackRelatedRedemptionsRedemptionsItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemption_rollback_related_redemptions_rollbacks_item.py b/voucherify/models/redemption_rollback_related_redemptions_rollbacks_item.py new file mode 100644 index 00000000..4e68f9ca --- /dev/null +++ b/voucherify/models/redemption_rollback_related_redemptions_rollbacks_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionRollbackRelatedRedemptionsRollbacksItem(BaseModel): + """ + RedemptionRollbackRelatedRedemptionsRollbacksItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the redemption rollback.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionRollbackRelatedRedemptionsRollbacksItem 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 RedemptionRollbackRelatedRedemptionsRollbacksItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemption_voucher.py b/voucherify/models/redemption_voucher.py new file mode 100644 index 00000000..44115a95 --- /dev/null +++ b/voucherify/models/redemption_voucher.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.redemption_voucher_gift import RedemptionVoucherGift +from voucherify.models.redemption_voucher_loyalty_card import RedemptionVoucherLoyaltyCard +from voucherify.models.redemption_voucher_publish import RedemptionVoucherPublish +from voucherify.models.redemption_voucher_redemption import RedemptionVoucherRedemption +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionVoucher(BaseModel): + """ + Defines the details of the voucher being redeemed. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[RedemptionVoucherGift] = None + loyalty_card: Optional[RedemptionVoucherLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[RedemptionVoucherPublish] = None + redemption: Optional[RedemptionVoucherRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + holder: Optional[SimpleCustomer] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments", "holder"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of holder + if self.holder: + _dict['holder'] = self.holder.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionVoucher 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": RedemptionVoucherGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionVoucherLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": RedemptionVoucherPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": RedemptionVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "holder": SimpleCustomer.from_dict(obj["holder"]) if obj.get("holder") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemption_voucher_gift.py b/voucherify/models/redemption_voucher_gift.py new file mode 100644 index 00000000..c2cb1338 --- /dev/null +++ b/voucherify/models/redemption_voucher_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class RedemptionVoucherGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionVoucherGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionVoucherGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/redemption_voucher_loyalty_card.py b/voucherify/models/redemption_voucher_loyalty_card.py new file mode 100644 index 00000000..bd404971 --- /dev/null +++ b/voucherify/models/redemption_voucher_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionVoucherLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionVoucherLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionVoucherLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/redemption_voucher_publish.py b/voucherify/models/redemption_voucher_publish.py new file mode 100644 index 00000000..d010b0d1 --- /dev/null +++ b/voucherify/models/redemption_voucher_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionVoucherPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionVoucherPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionVoucherPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemption_voucher_redemption.py b/voucherify/models/redemption_voucher_redemption.py new file mode 100644 index 00000000..68d4d5e9 --- /dev/null +++ b/voucherify/models/redemption_voucher_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionVoucherRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body.py b/voucherify/models/redemptions_get_response_body.py new file mode 100644 index 00000000..207c35e7 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body.py @@ -0,0 +1,326 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.redemptions_get_response_body_channel import RedemptionsGetResponseBodyChannel +from voucherify.models.redemptions_get_response_body_customer import RedemptionsGetResponseBodyCustomer +from voucherify.models.redemptions_get_response_body_gift import RedemptionsGetResponseBodyGift +from voucherify.models.redemptions_get_response_body_loyalty_card import RedemptionsGetResponseBodyLoyaltyCard +from voucherify.models.redemptions_get_response_body_order import RedemptionsGetResponseBodyOrder +from voucherify.models.redemptions_get_response_body_promotion_tier import RedemptionsGetResponseBodyPromotionTier +from voucherify.models.redemptions_get_response_body_related_redemptions import RedemptionsGetResponseBodyRelatedRedemptions +from voucherify.models.redemptions_get_response_body_voucher import RedemptionsGetResponseBodyVoucher +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBody(BaseModel): + """ + RedemptionsGetResponseBody + """ # noqa: E501 + id: Optional[StrictStr] = None + object: Optional[StrictStr] = None + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the redeeming customer.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + metadata: Optional[Dict[str, Any]] = None + amount: Optional[StrictInt] = Field(default=None, description="For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer.") + redemption: Optional[StrictStr] = Field(default=None, description="Unique redemption ID of the parent redemption.") + result: Optional[StrictStr] = Field(default=None, description="Redemption result.") + status: Optional[StrictStr] = None + related_redemptions: Optional[RedemptionsGetResponseBodyRelatedRedemptions] = None + failure_code: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed.") + order: Optional[RedemptionsGetResponseBodyOrder] = None + channel: Optional[RedemptionsGetResponseBodyChannel] = None + customer: Optional[RedemptionsGetResponseBodyCustomer] = None + related_object_type: Optional[StrictStr] = Field(default=None, description="Defines the related object.") + related_object_id: Optional[StrictStr] = None + voucher: Optional[RedemptionsGetResponseBodyVoucher] = None + promotion_tier: Optional[RedemptionsGetResponseBodyPromotionTier] = None + reward: Optional[RedemptionRewardResult] = None + gift: Optional[RedemptionsGetResponseBodyGift] = None + loyalty_card: Optional[RedemptionsGetResponseBodyLoyaltyCard] = None + reason: Optional[StrictStr] = Field(default=None, description="System generated cause for the redemption being invalid in the context of the provided parameters.") + __properties: ClassVar[List[str]] = ["id", "object", "date", "customer_id", "tracking_id", "metadata", "amount", "redemption", "result", "status", "related_redemptions", "failure_code", "failure_message", "order", "channel", "customer", "related_object_type", "related_object_id", "voucher", "promotion_tier", "reward", "gift", "loyalty_card", "reason"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption', 'redemption_rollback']): + raise ValueError("must be one of enum values ('redemption', 'redemption_rollback')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCEEDED', 'FAILED', 'ROLLED_BACK']): + raise ValueError("must be one of enum values ('SUCCEEDED', 'FAILED', 'ROLLED_BACK')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'redemption']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'redemption')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBody 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 related_redemptions + if self.related_redemptions: + _dict['related_redemptions'] = self.related_redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of channel + if self.channel: + _dict['channel'] = self.channel.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion_tier + if self.promotion_tier: + _dict['promotion_tier'] = self.promotion_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if var_date (nullable) is None + # and model_fields_set contains the field + if self.var_date is None and "var_date" in self.model_fields_set: + _dict['date'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if related_redemptions (nullable) is None + # and model_fields_set contains the field + if self.related_redemptions is None and "related_redemptions" in self.model_fields_set: + _dict['related_redemptions'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if voucher (nullable) is None + # and model_fields_set contains the field + if self.voucher is None and "voucher" in self.model_fields_set: + _dict['voucher'] = None + + # set to None if promotion_tier (nullable) is None + # and model_fields_set contains the field + if self.promotion_tier is None and "promotion_tier" in self.model_fields_set: + _dict['promotion_tier'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBody 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"), + "object": obj.get("object"), + "date": obj.get("date"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "amount": obj.get("amount"), + "redemption": obj.get("redemption"), + "result": obj.get("result"), + "status": obj.get("status"), + "related_redemptions": RedemptionsGetResponseBodyRelatedRedemptions.from_dict(obj["related_redemptions"]) if obj.get("related_redemptions") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message"), + "order": RedemptionsGetResponseBodyOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "channel": RedemptionsGetResponseBodyChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, + "customer": RedemptionsGetResponseBodyCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "related_object_type": obj.get("related_object_type"), + "related_object_id": obj.get("related_object_id"), + "voucher": RedemptionsGetResponseBodyVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "promotion_tier": RedemptionsGetResponseBodyPromotionTier.from_dict(obj["promotion_tier"]) if obj.get("promotion_tier") is not None else None, + "reward": RedemptionRewardResult.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "gift": RedemptionsGetResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionsGetResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "reason": obj.get("reason") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_channel.py b/voucherify/models/redemptions_get_response_body_channel.py new file mode 100644 index 00000000..fa5d8750 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_channel.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyChannel(BaseModel): + """ + RedemptionsGetResponseBodyChannel + """ # noqa: E501 + channel_id: Optional[StrictStr] = None + channel_type: Optional[StrictStr] = Field(default=None, description="The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.") + __properties: ClassVar[List[str]] = ["channel_id", "channel_type"] + + @field_validator('channel_type') + def channel_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['USER', 'API']): + raise ValueError("must be one of enum values ('USER', 'API')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyChannel 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, + ) + # set to None if channel_id (nullable) is None + # and model_fields_set contains the field + if self.channel_id is None and "channel_id" in self.model_fields_set: + _dict['channel_id'] = None + + # set to None if channel_type (nullable) is None + # and model_fields_set contains the field + if self.channel_type is None and "channel_type" in self.model_fields_set: + _dict['channel_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyChannel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel_id": obj.get("channel_id"), + "channel_type": obj.get("channel_type") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_customer.py b/voucherify/models/redemptions_get_response_body_customer.py new file mode 100644 index 00000000..4d36d823 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_customer.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyCustomer(BaseModel): + """ + RedemptionsGetResponseBodyCustomer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of an existing customer. It is assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service.") + metadata: Optional[Dict[str, Any]] = None + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "name", "email", "source_id", "metadata", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyCustomer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyCustomer 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"), + "name": obj.get("name"), + "email": obj.get("email"), + "source_id": obj.get("source_id"), + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_gift.py b/voucherify/models/redemptions_get_response_body_gift.py new file mode 100644 index 00000000..21bf0ff5 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyGift(BaseModel): + """ + RedemptionsGetResponseBodyGift + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned).") + __properties: ClassVar[List[str]] = ["amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_loyalty_card.py b/voucherify/models/redemptions_get_response_body_loyalty_card.py new file mode 100644 index 00000000..bd046ff9 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyLoyaltyCard(BaseModel): + """ + RedemptionsGetResponseBodyLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_order.py b/voucherify/models/redemptions_get_response_body_order.py new file mode 100644 index 00000000..0ad6f40a --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_order.py @@ -0,0 +1,277 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.redemptions_get_response_body_order_customer import RedemptionsGetResponseBodyOrderCustomer +from voucherify.models.redemptions_get_response_body_order_referrer import RedemptionsGetResponseBodyOrderReferrer +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyOrder(BaseModel): + """ + RedemptionsGetResponseBodyOrder + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied to the order.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied to the order.") + total_amount: Optional[StrictInt] = Field(default=None, description="Order amount after undoing all the discounts through the rollback redemption.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + items_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)`") + total_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`") + items: Optional[List[OrderCalculatedItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = None + object: Optional[StrictStr] = Field(default='order', description="The type of the object represented by JSON.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was last updated in ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[RedemptionsGetResponseBodyOrderCustomer] = None + referrer: Optional[RedemptionsGetResponseBodyOrderReferrer] = None + redemptions: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items_discount_amount", "total_discount_amount", "total_amount", "applied_discount_amount", "items_applied_discount_amount", "total_applied_discount_amount", "items", "metadata", "object", "created_at", "updated_at", "customer_id", "referrer_id", "customer", "referrer", "redemptions"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyOrder 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_discount_amount is None and "items_discount_amount" in self.model_fields_set: + _dict['items_discount_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if items_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_applied_discount_amount is None and "items_applied_discount_amount" in self.model_fields_set: + _dict['items_applied_discount_amount'] = None + + # set to None if total_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_applied_discount_amount is None and "total_applied_discount_amount" in self.model_fields_set: + _dict['total_applied_discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if customer (nullable) is None + # and model_fields_set contains the field + if self.customer is None and "customer" in self.model_fields_set: + _dict['customer'] = None + + # set to None if referrer (nullable) is None + # and model_fields_set contains the field + if self.referrer is None and "referrer" in self.model_fields_set: + _dict['referrer'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyOrder 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items_discount_amount": obj.get("items_discount_amount"), + "total_discount_amount": obj.get("total_discount_amount"), + "total_amount": obj.get("total_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "items_applied_discount_amount": obj.get("items_applied_discount_amount"), + "total_applied_discount_amount": obj.get("total_applied_discount_amount"), + "items": [OrderCalculatedItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'order', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "customer_id": obj.get("customer_id"), + "referrer_id": obj.get("referrer_id"), + "customer": RedemptionsGetResponseBodyOrderCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": RedemptionsGetResponseBodyOrderReferrer.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None, + "redemptions": obj.get("redemptions") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_order_customer.py b/voucherify/models/redemptions_get_response_body_order_customer.py new file mode 100644 index 00000000..27ec8590 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_order_customer.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyOrderCustomer(BaseModel): + """ + RedemptionsGetResponseBodyOrderCustomer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyOrderCustomer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyOrderCustomer 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_order_referrer.py b/voucherify/models/redemptions_get_response_body_order_referrer.py new file mode 100644 index 00000000..548298ee --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_order_referrer.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyOrderReferrer(BaseModel): + """ + RedemptionsGetResponseBodyOrderReferrer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyOrderReferrer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyOrderReferrer 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_promotion_tier.py b/voucherify/models/redemptions_get_response_body_promotion_tier.py new file mode 100644 index 00000000..c7b80dd7 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_promotion_tier.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.redemptions_get_response_body_promotion_tier_action import RedemptionsGetResponseBodyPromotionTierAction +from voucherify.models.redemptions_get_response_body_promotion_tier_campaign import RedemptionsGetResponseBodyPromotionTierCampaign +from voucherify.models.redemptions_get_response_body_promotion_tier_summary import RedemptionsGetResponseBodyPromotionTierSummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyPromotionTier(BaseModel): + """ + RedemptionsGetResponseBodyPromotionTier + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[RedemptionsGetResponseBodyPromotionTierAction] = None + metadata: Optional[Dict[str, Any]] = None + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[RedemptionsGetResponseBodyPromotionTierCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[RedemptionsGetResponseBodyPromotionTierSummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTier 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if action (nullable) is None + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: + _dict['action'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict['summary'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTier 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": RedemptionsGetResponseBodyPromotionTierAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": RedemptionsGetResponseBodyPromotionTierCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": RedemptionsGetResponseBodyPromotionTierSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_promotion_tier_action.py b/voucherify/models/redemptions_get_response_body_promotion_tier_action.py new file mode 100644 index 00000000..26dd3f29 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_promotion_tier_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyPromotionTierAction(BaseModel): + """ + RedemptionsGetResponseBodyPromotionTierAction + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_promotion_tier_campaign.py b/voucherify/models/redemptions_get_response_body_promotion_tier_campaign.py new file mode 100644 index 00000000..b0046cd8 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_promotion_tier_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyPromotionTierCampaign(BaseModel): + """ + RedemptionsGetResponseBodyPromotionTierCampaign + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_promotion_tier_summary.py b/voucherify/models/redemptions_get_response_body_promotion_tier_summary.py new file mode 100644 index 00000000..f4b9d39c --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_promotion_tier_summary.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemptions_get_response_body_promotion_tier_summary_orders import RedemptionsGetResponseBodyPromotionTierSummaryOrders +from voucherify.models.redemptions_get_response_body_promotion_tier_summary_redemptions import RedemptionsGetResponseBodyPromotionTierSummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyPromotionTierSummary(BaseModel): + """ + RedemptionsGetResponseBodyPromotionTierSummary + """ # noqa: E501 + redemptions: Optional[RedemptionsGetResponseBodyPromotionTierSummaryRedemptions] = None + orders: Optional[RedemptionsGetResponseBodyPromotionTierSummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierSummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if orders (nullable) is None + # and model_fields_set contains the field + if self.orders is None and "orders" in self.model_fields_set: + _dict['orders'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": RedemptionsGetResponseBodyPromotionTierSummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": RedemptionsGetResponseBodyPromotionTierSummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_promotion_tier_summary_orders.py b/voucherify/models/redemptions_get_response_body_promotion_tier_summary_orders.py new file mode 100644 index 00000000..3c7c0ec6 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_promotion_tier_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyPromotionTierSummaryOrders(BaseModel): + """ + RedemptionsGetResponseBodyPromotionTierSummaryOrders + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierSummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierSummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_promotion_tier_summary_redemptions.py b/voucherify/models/redemptions_get_response_body_promotion_tier_summary_redemptions.py new file mode 100644 index 00000000..40522b1f --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_promotion_tier_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyPromotionTierSummaryRedemptions(BaseModel): + """ + RedemptionsGetResponseBodyPromotionTierSummaryRedemptions + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierSummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyPromotionTierSummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_related_redemptions.py b/voucherify/models/redemptions_get_response_body_related_redemptions.py new file mode 100644 index 00000000..f28e30bb --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_related_redemptions.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemptions_get_response_body_related_redemptions_redemptions_item import RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_get_response_body_related_redemptions_rollbacks_item import RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyRelatedRedemptions(BaseModel): + """ + RedemptionsGetResponseBodyRelatedRedemptions + """ # noqa: E501 + rollbacks: Optional[List[RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem]] = None + redemptions: Optional[List[RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem]] = None + __properties: ClassVar[List[str]] = ["rollbacks", "redemptions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyRelatedRedemptions 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if rollbacks (nullable) is None + # and model_fields_set contains the field + if self.rollbacks is None and "rollbacks" in self.model_fields_set: + _dict['rollbacks'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyRelatedRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "redemptions": [RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_related_redemptions_redemptions_item.py b/voucherify/models/redemptions_get_response_body_related_redemptions_redemptions_item.py new file mode 100644 index 00000000..31673a3d --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_related_redemptions_redemptions_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem(BaseModel): + """ + RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem 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 RedemptionsGetResponseBodyRelatedRedemptionsRedemptionsItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_related_redemptions_rollbacks_item.py b/voucherify/models/redemptions_get_response_body_related_redemptions_rollbacks_item.py new file mode 100644 index 00000000..66aad95c --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_related_redemptions_rollbacks_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem(BaseModel): + """ + RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem + """ # noqa: E501 + id: Optional[StrictStr] = None + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem 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 RedemptionsGetResponseBodyRelatedRedemptionsRollbacksItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_voucher.py b/voucherify/models/redemptions_get_response_body_voucher.py new file mode 100644 index 00000000..081da6f1 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_voucher.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.redemptions_get_response_body_voucher_gift import RedemptionsGetResponseBodyVoucherGift +from voucherify.models.redemptions_get_response_body_voucher_loyalty_card import RedemptionsGetResponseBodyVoucherLoyaltyCard +from voucherify.models.redemptions_get_response_body_voucher_publish import RedemptionsGetResponseBodyVoucherPublish +from voucherify.models.redemptions_get_response_body_voucher_redemption import RedemptionsGetResponseBodyVoucherRedemption +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyVoucher(BaseModel): + """ + RedemptionsGetResponseBodyVoucher + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[RedemptionsGetResponseBodyVoucherGift] = None + loyalty_card: Optional[RedemptionsGetResponseBodyVoucherLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = None + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[RedemptionsGetResponseBodyVoucherPublish] = None + redemption: Optional[RedemptionsGetResponseBodyVoucherRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + holder: Optional[SimpleCustomer] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments", "holder"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of holder + if self.holder: + _dict['holder'] = self.holder.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucher 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": RedemptionsGetResponseBodyVoucherGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionsGetResponseBodyVoucherLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": RedemptionsGetResponseBodyVoucherPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": RedemptionsGetResponseBodyVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "holder": SimpleCustomer.from_dict(obj["holder"]) if obj.get("holder") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_voucher_gift.py b/voucherify/models/redemptions_get_response_body_voucher_gift.py new file mode 100644 index 00000000..72573964 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_voucher_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class RedemptionsGetResponseBodyVoucherGift(BaseModel): + """ + RedemptionsGetResponseBodyVoucherGift + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_voucher_loyalty_card.py b/voucherify/models/redemptions_get_response_body_voucher_loyalty_card.py new file mode 100644 index 00000000..4463a76f --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_voucher_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyVoucherLoyaltyCard(BaseModel): + """ + RedemptionsGetResponseBodyVoucherLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_voucher_publish.py b/voucherify/models/redemptions_get_response_body_voucher_publish.py new file mode 100644 index 00000000..7902fa5f --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_voucher_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyVoucherPublish(BaseModel): + """ + RedemptionsGetResponseBodyVoucherPublish + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemptions_get_response_body_voucher_redemption.py b/voucherify/models/redemptions_get_response_body_voucher_redemption.py new file mode 100644 index 00000000..c7453141 --- /dev/null +++ b/voucherify/models/redemptions_get_response_body_voucher_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsGetResponseBodyVoucherRedemption(BaseModel): + """ + RedemptionsGetResponseBodyVoucherRedemption + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsGetResponseBodyVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body.py b/voucherify/models/redemptions_list_response_body.py new file mode 100644 index 00000000..b10ff017 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemptions_list_response_body_redemptions_item import RedemptionsListResponseBodyRedemptionsItem +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/redemptions`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about redemptions in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='redemptions', description="Identifies the name of the attribute that contains the array of redemption objects.") + redemptions: Optional[List[RedemptionsListResponseBodyRedemptionsItem]] = None + total: Optional[StrictInt] = Field(default=None, description="Total number of redemptions.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "redemptions", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBody 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 redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'redemptions', + "redemptions": [RedemptionsListResponseBodyRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item.py b/voucherify/models/redemptions_list_response_body_redemptions_item.py new file mode 100644 index 00000000..ad9bb2a7 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item.py @@ -0,0 +1,256 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.redemptions_list_response_body_redemptions_item_channel import RedemptionsListResponseBodyRedemptionsItemChannel +from voucherify.models.redemptions_list_response_body_redemptions_item_customer import RedemptionsListResponseBodyRedemptionsItemCustomer +from voucherify.models.redemptions_list_response_body_redemptions_item_gift import RedemptionsListResponseBodyRedemptionsItemGift +from voucherify.models.redemptions_list_response_body_redemptions_item_loyalty_card import RedemptionsListResponseBodyRedemptionsItemLoyaltyCard +from voucherify.models.redemptions_list_response_body_redemptions_item_order import RedemptionsListResponseBodyRedemptionsItemOrder +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier import RedemptionsListResponseBodyRedemptionsItemPromotionTier +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher import RedemptionsListResponseBodyRedemptionsItemVoucher +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItem(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = None + object: Optional[StrictStr] = None + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the redeeming customer.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + metadata: Optional[Dict[str, Any]] = None + amount: Optional[StrictInt] = Field(default=None, description="For gift cards, this is a positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the number of redeemed credits. For loyalty cards, this is the number of loyalty points used in the transaction. and For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer.") + redemption: Optional[StrictStr] = Field(default=None, description="Unique redemption ID of the parent redemption.") + result: Optional[StrictStr] = Field(default=None, description="Redemption result.") + status: Optional[StrictStr] = None + related_redemptions: Optional[RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions] = None + failure_code: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed.") + order: Optional[RedemptionsListResponseBodyRedemptionsItemOrder] = None + channel: Optional[RedemptionsListResponseBodyRedemptionsItemChannel] = None + customer: Optional[RedemptionsListResponseBodyRedemptionsItemCustomer] = None + related_object_type: Optional[StrictStr] = Field(default=None, description="Defines the related object.") + related_object_id: Optional[StrictStr] = None + voucher: Optional[RedemptionsListResponseBodyRedemptionsItemVoucher] = None + promotion_tier: Optional[RedemptionsListResponseBodyRedemptionsItemPromotionTier] = None + reward: Optional[RedemptionRewardResult] = None + gift: Optional[RedemptionsListResponseBodyRedemptionsItemGift] = None + loyalty_card: Optional[RedemptionsListResponseBodyRedemptionsItemLoyaltyCard] = None + reason: Optional[StrictStr] = Field(default=None, description="System generated cause for the redemption being invalid in the context of the provided parameters.") + __properties: ClassVar[List[str]] = ["id", "object", "date", "customer_id", "tracking_id", "metadata", "amount", "redemption", "result", "status", "related_redemptions", "failure_code", "failure_message", "order", "channel", "customer", "related_object_type", "related_object_id", "voucher", "promotion_tier", "reward", "gift", "loyalty_card", "reason"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption', 'redemption_rollback']): + raise ValueError("must be one of enum values ('redemption', 'redemption_rollback')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCEEDED', 'FAILED', 'ROLLED_BACK']): + raise ValueError("must be one of enum values ('SUCCEEDED', 'FAILED', 'ROLLED_BACK')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'redemption']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'redemption')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItem 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 related_redemptions + if self.related_redemptions: + _dict['related_redemptions'] = self.related_redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of channel + if self.channel: + _dict['channel'] = self.channel.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion_tier + if self.promotion_tier: + _dict['promotion_tier'] = self.promotion_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if var_date (nullable) is None + # and model_fields_set contains the field + if self.var_date is None and "var_date" in self.model_fields_set: + _dict['date'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItem 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"), + "object": obj.get("object"), + "date": obj.get("date"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "amount": obj.get("amount"), + "redemption": obj.get("redemption"), + "result": obj.get("result"), + "status": obj.get("status"), + "related_redemptions": RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions.from_dict(obj["related_redemptions"]) if obj.get("related_redemptions") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message"), + "order": RedemptionsListResponseBodyRedemptionsItemOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "channel": RedemptionsListResponseBodyRedemptionsItemChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, + "customer": RedemptionsListResponseBodyRedemptionsItemCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "related_object_type": obj.get("related_object_type"), + "related_object_id": obj.get("related_object_id"), + "voucher": RedemptionsListResponseBodyRedemptionsItemVoucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "promotion_tier": RedemptionsListResponseBodyRedemptionsItemPromotionTier.from_dict(obj["promotion_tier"]) if obj.get("promotion_tier") is not None else None, + "reward": RedemptionRewardResult.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "gift": RedemptionsListResponseBodyRedemptionsItemGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionsListResponseBodyRedemptionsItemLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "reason": obj.get("reason") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_channel.py b/voucherify/models/redemptions_list_response_body_redemptions_item_channel.py new file mode 100644 index 00000000..dd566f08 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_channel.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemChannel(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemChannel + """ # noqa: E501 + channel_id: Optional[StrictStr] = None + channel_type: Optional[StrictStr] = Field(default=None, description="The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.") + __properties: ClassVar[List[str]] = ["channel_id", "channel_type"] + + @field_validator('channel_type') + def channel_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['USER', 'API']): + raise ValueError("must be one of enum values ('USER', 'API')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemChannel 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, + ) + # set to None if channel_type (nullable) is None + # and model_fields_set contains the field + if self.channel_type is None and "channel_type" in self.model_fields_set: + _dict['channel_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemChannel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel_id": obj.get("channel_id"), + "channel_type": obj.get("channel_type") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_customer.py b/voucherify/models/redemptions_list_response_body_redemptions_item_customer.py new file mode 100644 index 00000000..df392b17 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_customer.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemCustomer(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemCustomer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of an existing customer. It is assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service.") + metadata: Optional[Dict[str, Any]] = None + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "name", "email", "source_id", "metadata", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemCustomer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemCustomer 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"), + "name": obj.get("name"), + "email": obj.get("email"), + "source_id": obj.get("source_id"), + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_gift.py b/voucherify/models/redemptions_list_response_body_redemptions_item_gift.py new file mode 100644 index 00000000..511aee68 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_gift.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemGift(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemGift + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Amount subtracted from the gift card as a result of the redemption. The amount is expressed as the smallest currency unit (e.g. 100 cents for $1.00). and Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned).") + __properties: ClassVar[List[str]] = ["amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemGift 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 RedemptionsListResponseBodyRedemptionsItemGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_loyalty_card.py b/voucherify/models/redemptions_list_response_body_redemptions_item_loyalty_card.py new file mode 100644 index 00000000..22789314 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_loyalty_card.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemLoyaltyCard(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points subtracted from the loyalty card as a result of the redemption. and Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemLoyaltyCard 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 RedemptionsListResponseBodyRedemptionsItemLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_order.py b/voucherify/models/redemptions_list_response_body_redemptions_item_order.py new file mode 100644 index 00000000..509cef32 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_order.py @@ -0,0 +1,257 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated_item import OrderCalculatedItem +from voucherify.models.redemptions_list_response_body_redemptions_item_order_customer import RedemptionsListResponseBodyRedemptionsItemOrderCustomer +from voucherify.models.redemptions_list_response_body_redemptions_item_order_referrer import RedemptionsListResponseBodyRedemptionsItemOrderReferrer +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemOrder(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemOrder + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.") + source_id: Optional[StrictStr] = Field(default=None, description="Unique source ID of an existing order that will be linked to the redemption of this request.") + status: Optional[StrictStr] = Field(default=None, description="The order status.") + amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + initial_amount: Optional[StrictInt] = Field(default=None, description="A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.") + discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level discounts applied to the order.") + items_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied to the order.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied to the order.") + total_amount: Optional[StrictInt] = Field(default=None, description="Order amount after undoing all the discounts through the rollback redemption.") + applied_discount_amount: Optional[StrictInt] = Field(default=None, description="This field shows the order-level discount applied.") + items_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all product-specific discounts applied in a particular request. `sum(items, i => i.applied_discount_amount)`") + total_applied_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of all order-level AND all product-specific discounts applied in a particular request. `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`") + items: Optional[List[OrderCalculatedItem]] = Field(default=None, description="Array of items applied to the order.") + metadata: Optional[Dict[str, Any]] = None + object: Optional[StrictStr] = Field(default='order', description="The type of the object represented by JSON.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was last updated in ISO 8601 format.") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the customer making the purchase.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique referrer ID.") + customer: Optional[RedemptionsListResponseBodyRedemptionsItemOrderCustomer] = None + referrer: Optional[RedemptionsListResponseBodyRedemptionsItemOrderReferrer] = None + redemptions: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["id", "source_id", "status", "amount", "initial_amount", "discount_amount", "items_discount_amount", "total_discount_amount", "total_amount", "applied_discount_amount", "items_applied_discount_amount", "total_applied_discount_amount", "items", "metadata", "object", "created_at", "updated_at", "customer_id", "referrer_id", "customer", "referrer", "redemptions"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CREATED', 'PAID', 'CANCELED', 'FULFILLED']): + raise ValueError("must be one of enum values ('CREATED', 'PAID', 'CANCELED', 'FULFILLED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['order']): + raise ValueError("must be one of enum values ('order')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemOrder 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of referrer + if self.referrer: + _dict['referrer'] = self.referrer.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if initial_amount (nullable) is None + # and model_fields_set contains the field + if self.initial_amount is None and "initial_amount" in self.model_fields_set: + _dict['initial_amount'] = None + + # set to None if discount_amount (nullable) is None + # and model_fields_set contains the field + if self.discount_amount is None and "discount_amount" in self.model_fields_set: + _dict['discount_amount'] = None + + # set to None if items_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_discount_amount is None and "items_discount_amount" in self.model_fields_set: + _dict['items_discount_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.applied_discount_amount is None and "applied_discount_amount" in self.model_fields_set: + _dict['applied_discount_amount'] = None + + # set to None if items_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.items_applied_discount_amount is None and "items_applied_discount_amount" in self.model_fields_set: + _dict['items_applied_discount_amount'] = None + + # set to None if total_applied_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_applied_discount_amount is None and "total_applied_discount_amount" in self.model_fields_set: + _dict['total_applied_discount_amount'] = None + + # set to None if items (nullable) is None + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: + _dict['items'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemOrder 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"), + "source_id": obj.get("source_id"), + "status": obj.get("status"), + "amount": obj.get("amount"), + "initial_amount": obj.get("initial_amount"), + "discount_amount": obj.get("discount_amount"), + "items_discount_amount": obj.get("items_discount_amount"), + "total_discount_amount": obj.get("total_discount_amount"), + "total_amount": obj.get("total_amount"), + "applied_discount_amount": obj.get("applied_discount_amount"), + "items_applied_discount_amount": obj.get("items_applied_discount_amount"), + "total_applied_discount_amount": obj.get("total_applied_discount_amount"), + "items": [OrderCalculatedItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'order', + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "customer_id": obj.get("customer_id"), + "referrer_id": obj.get("referrer_id"), + "customer": RedemptionsListResponseBodyRedemptionsItemOrderCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "referrer": RedemptionsListResponseBodyRedemptionsItemOrderReferrer.from_dict(obj["referrer"]) if obj.get("referrer") is not None else None, + "redemptions": obj.get("redemptions") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_order_customer.py b/voucherify/models/redemptions_list_response_body_redemptions_item_order_customer.py new file mode 100644 index 00000000..b88a5a0a --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_order_customer.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemOrderCustomer(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemOrderCustomer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemOrderCustomer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemOrderCustomer 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_order_referrer.py b/voucherify/models/redemptions_list_response_body_redemptions_item_order_referrer.py new file mode 100644 index 00000000..0f0f8beb --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_order_referrer.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemOrderReferrer(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemOrderReferrer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemOrderReferrer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemOrderReferrer 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier.py b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier.py new file mode 100644 index 00000000..7dd1b9c1 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier.py @@ -0,0 +1,244 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_action import RedemptionsListResponseBodyRedemptionsItemPromotionTierAction +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_campaign import RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary +from voucherify.models.validation_rule_assignments_list import ValidationRuleAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemPromotionTier(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemPromotionTier + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique promotion tier ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the promotion tier was updated. The value is shown in the ISO 8601 format.") + name: Optional[StrictStr] = Field(default=None, description="Name of the promotion tier.") + banner: Optional[StrictStr] = Field(default=None, description="Text to be displayed to your customers on your website.") + action: Optional[RedemptionsListResponseBodyRedemptionsItemPromotionTierAction] = None + metadata: Optional[Dict[str, Any]] = None + hierarchy: Optional[StrictInt] = Field(default=None, description="The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.") + promotion_id: Optional[StrictStr] = Field(default=None, description="Promotion unique ID.") + campaign: Optional[RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign] = None + campaign_id: Optional[StrictStr] = Field(default=None, description="Promotion tier's parent campaign's unique ID.") + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* promotion tier - `false` indicates an *inactive* promotion tier") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + summary: Optional[RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary] = None + object: Optional[StrictStr] = Field(default='promotion_tier', description="The type of the object represented by JSON. This object stores information about the promotion tier.") + validation_rule_assignments: Optional[ValidationRuleAssignmentsList] = None + category_id: Optional[StrictStr] = Field(default=None, description="Promotion tier category ID.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "updated_at", "name", "banner", "action", "metadata", "hierarchy", "promotion_id", "campaign", "campaign_id", "active", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "summary", "object", "validation_rule_assignments", "category_id", "categories"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTier 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 action + if self.action: + _dict['action'] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # override the default output from pydantic by calling `to_dict()` of validation_rule_assignments + if self.validation_rule_assignments: + _dict['validation_rule_assignments'] = self.validation_rule_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + # set to None if hierarchy (nullable) is None + # and model_fields_set contains the field + if self.hierarchy is None and "hierarchy" in self.model_fields_set: + _dict['hierarchy'] = None + + # set to None if promotion_id (nullable) is None + # and model_fields_set contains the field + if self.promotion_id is None and "promotion_id" in self.model_fields_set: + _dict['promotion_id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTier 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"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "name": obj.get("name"), + "banner": obj.get("banner"), + "action": RedemptionsListResponseBodyRedemptionsItemPromotionTierAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "metadata": obj.get("metadata"), + "hierarchy": obj.get("hierarchy"), + "promotion_id": obj.get("promotion_id"), + "campaign": RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "campaign_id": obj.get("campaign_id"), + "active": obj.get("active"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "summary": RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, + "object": obj.get("object") if obj.get("object") is not None else 'promotion_tier', + "validation_rule_assignments": ValidationRuleAssignmentsList.from_dict(obj["validation_rule_assignments"]) if obj.get("validation_rule_assignments") is not None else None, + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_action.py b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_action.py new file mode 100644 index 00000000..021351b1 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_action.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemPromotionTierAction(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemPromotionTierAction + """ # noqa: E501 + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["discount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierAction 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_campaign.py b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_campaign.py new file mode 100644 index 00000000..b77f4749 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_campaign.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. - `true` indicates an *active* campaign - `false` indicates an *inactive* campaign") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID that this campaign belongs to.") + object: Optional[StrictStr] = Field(default='campaign', description="The type of the object represented by the campaign object. This object stores information about the campaign.") + __properties: ClassVar[List[str]] = ["id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "category_id", "object"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierCampaign 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"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "category_id": obj.get("category_id"), + "object": obj.get("object") if obj.get("object") is not None else 'campaign' + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary.py b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary.py new file mode 100644 index 00000000..624bd9fa --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders +from voucherify.models.redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions import RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary + """ # noqa: E501 + redemptions: Optional[RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions] = None + orders: Optional[RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders] = None + __properties: ClassVar[List[str]] = ["redemptions", "orders"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary 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 redemptions + if self.redemptions: + _dict['redemptions'] = self.redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of orders + if self.orders: + _dict['orders'] = self.orders.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions.from_dict(obj["redemptions"]) if obj.get("redemptions") is not None else None, + "orders": RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders.from_dict(obj["orders"]) if obj.get("orders") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders.py b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders.py new file mode 100644 index 00000000..a8a36690 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_orders.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders + """ # noqa: E501 + total_amount: Optional[StrictInt] = Field(default=None, description="Sum of order totals.") + total_discount_amount: Optional[StrictInt] = Field(default=None, description="Sum of total discount applied using the promotion tier.") + __properties: ClassVar[List[str]] = ["total_amount", "total_discount_amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders 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, + ) + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['total_amount'] = None + + # set to None if total_discount_amount (nullable) is None + # and model_fields_set contains the field + if self.total_discount_amount is None and "total_discount_amount" in self.model_fields_set: + _dict['total_discount_amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_amount": obj.get("total_amount"), + "total_discount_amount": obj.get("total_discount_amount") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions.py b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions.py new file mode 100644 index 00000000..92a8707e --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_promotion_tier_summary_redemptions.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions + """ # noqa: E501 + total_redeemed: Optional[StrictInt] = Field(default=None, description="Number of times the promotion tier was redeemed.") + __properties: ClassVar[List[str]] = ["total_redeemed"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions 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, + ) + # set to None if total_redeemed (nullable) is None + # and model_fields_set contains the field + if self.total_redeemed is None and "total_redeemed" in self.model_fields_set: + _dict['total_redeemed'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemPromotionTierSummaryRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total_redeemed": obj.get("total_redeemed") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions.py b/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions.py new file mode 100644 index 00000000..8646a7f5 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item import RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions + """ # noqa: E501 + rollbacks: Optional[List[RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem]] = None + redemptions: Optional[List[RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem]] = None + __properties: ClassVar[List[str]] = ["rollbacks", "redemptions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemRelatedRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "redemptions": [RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item.py b/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item.py new file mode 100644 index 00000000..7cc5e7dc --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions_redemptions_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem 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 RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRedemptionsItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item.py b/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item.py new file mode 100644 index 00000000..d3635eae --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_related_redemptions_rollbacks_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem + """ # noqa: E501 + id: Optional[StrictStr] = None + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem 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 RedemptionsListResponseBodyRedemptionsItemRelatedRedemptionsRollbacksItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_voucher.py b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher.py new file mode 100644 index 00000000..982fbb27 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_gift import RedemptionsListResponseBodyRedemptionsItemVoucherGift +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_loyalty_card import RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_publish import RedemptionsListResponseBodyRedemptionsItemVoucherPublish +from voucherify.models.redemptions_list_response_body_redemptions_item_voucher_redemption import RedemptionsListResponseBodyRedemptionsItemVoucherRedemption +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemVoucher(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemVoucher + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[RedemptionsListResponseBodyRedemptionsItemVoucherGift] = None + loyalty_card: Optional[RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = None + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[RedemptionsListResponseBodyRedemptionsItemVoucherPublish] = None + redemption: Optional[RedemptionsListResponseBodyRedemptionsItemVoucherRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + holder: Optional[SimpleCustomer] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments", "holder"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # override the default output from pydantic by calling `to_dict()` of holder + if self.holder: + _dict['holder'] = self.holder.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucher 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": RedemptionsListResponseBodyRedemptionsItemVoucherGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": RedemptionsListResponseBodyRedemptionsItemVoucherPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": RedemptionsListResponseBodyRedemptionsItemVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None, + "holder": SimpleCustomer.from_dict(obj["holder"]) if obj.get("holder") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_gift.py b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_gift.py new file mode 100644 index 00000000..9c7241d5 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class RedemptionsListResponseBodyRedemptionsItemVoucherGift(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemVoucherGift + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card.py b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card.py new file mode 100644 index 00000000..0bef3602 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_publish.py b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_publish.py new file mode 100644 index 00000000..0f97fb7e --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemVoucherPublish(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemVoucherPublish + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_redemption.py b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_redemption.py new file mode 100644 index 00000000..34678a50 --- /dev/null +++ b/voucherify/models/redemptions_list_response_body_redemptions_item_voucher_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsListResponseBodyRedemptionsItemVoucherRedemption(BaseModel): + """ + RedemptionsListResponseBodyRedemptionsItemVoucherRedemption + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsListResponseBodyRedemptionsItemVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/redemptions_redeem_request_body.py b/voucherify/models/redemptions_redeem_request_body.py new file mode 100644 index 00000000..121c650c --- /dev/null +++ b/voucherify/models/redemptions_redeem_request_body.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer import Customer +from voucherify.models.order import Order +from voucherify.models.redemptions_redeem_request_body_options import RedemptionsRedeemRequestBodyOptions +from voucherify.models.redemptions_redeem_request_body_redeemables_item import RedemptionsRedeemRequestBodyRedeemablesItem +from voucherify.models.session import Session +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRedeemRequestBody(BaseModel): + """ + Response body schema for **POST** `v1/redemptions`. + """ # noqa: E501 + options: Optional[RedemptionsRedeemRequestBodyOptions] = None + redeemables: Optional[List[RedemptionsRedeemRequestBodyRedeemablesItem]] = None + order: Optional[Order] = None + customer: Optional[Customer] = None + session: Optional[Session] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Is correspondent to Customer's source_id") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format.") + __properties: ClassVar[List[str]] = ["options", "redeemables", "order", "customer", "session", "tracking_id", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBody 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 options + if self.options: + _dict['options'] = self.options.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in redeemables (list) + _items = [] + if self.redeemables: + for _item_redeemables in self.redeemables: + if _item_redeemables: + _items.append(_item_redeemables.to_dict()) + _dict['redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of session + if self.session: + _dict['session'] = self.session.to_dict() + # set to None if options (nullable) is None + # and model_fields_set contains the field + if self.options is None and "options" in self.model_fields_set: + _dict['options'] = None + + # set to None if redeemables (nullable) is None + # and model_fields_set contains the field + if self.redeemables is None and "redeemables" in self.model_fields_set: + _dict['redeemables'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "options": RedemptionsRedeemRequestBodyOptions.from_dict(obj["options"]) if obj.get("options") is not None else None, + "redeemables": [RedemptionsRedeemRequestBodyRedeemablesItem.from_dict(_item) for _item in obj["redeemables"]] if obj.get("redeemables") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "session": Session.from_dict(obj["session"]) if obj.get("session") is not None else None, + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/redemptions_redeem_request_body_options.py b/voucherify/models/redemptions_redeem_request_body_options.py new file mode 100644 index 00000000..97a1cd78 --- /dev/null +++ b/voucherify/models/redemptions_redeem_request_body_options.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsRedeemRequestBodyOptions(BaseModel): + """ + Configure parameters returned in the response. + """ # noqa: E501 + expand: Optional[List[StrictStr]] = Field(default=None, description="Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |") + __properties: ClassVar[List[str]] = ["expand"] + + @field_validator('expand') + def expand_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['order', 'redemption', 'redeemable', 'category']): + raise ValueError("each list item must be one of ('order', 'redemption', 'redeemable', 'category')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyOptions 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, + ) + # set to None if expand (nullable) is None + # and model_fields_set contains the field + if self.expand is None and "expand" in self.model_fields_set: + _dict['expand'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expand": obj.get("expand") + }) + return _obj + + diff --git a/voucherify/models/redemptions_redeem_request_body_redeemables_item.py b/voucherify/models/redemptions_redeem_request_body_redeemables_item.py new file mode 100644 index 00000000..9ff93f3b --- /dev/null +++ b/voucherify/models/redemptions_redeem_request_body_redeemables_item.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemptions_redeem_request_body_redeemables_item_gift import RedemptionsRedeemRequestBodyRedeemablesItemGift +from voucherify.models.redemptions_redeem_request_body_redeemables_item_reward import RedemptionsRedeemRequestBodyRedeemablesItemReward +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRedeemRequestBodyRedeemablesItem(BaseModel): + """ + RedemptionsRedeemRequestBodyRedeemablesItem + """ # noqa: E501 + object: Optional[StrictStr] = None + id: Optional[StrictStr] = None + gift: Optional[RedemptionsRedeemRequestBodyRedeemablesItemGift] = None + reward: Optional[RedemptionsRedeemRequestBodyRedeemablesItemReward] = None + __properties: ClassVar[List[str]] = ["object", "id", "gift", "reward"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'promotion_stack']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyRedeemablesItem 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 gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyRedeemablesItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object"), + "id": obj.get("id"), + "gift": RedemptionsRedeemRequestBodyRedeemablesItemGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "reward": RedemptionsRedeemRequestBodyRedeemablesItemReward.from_dict(obj["reward"]) if obj.get("reward") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_redeem_request_body_redeemables_item_gift.py b/voucherify/models/redemptions_redeem_request_body_redeemables_item_gift.py new file mode 100644 index 00000000..53f96499 --- /dev/null +++ b/voucherify/models/redemptions_redeem_request_body_redeemables_item_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRedeemRequestBodyRedeemablesItemGift(BaseModel): + """ + Contains information on the number of gift card credits that the customer wants to apply to the order. + """ # noqa: E501 + credits: Optional[StrictInt] = Field(default=None, description="The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + __properties: ClassVar[List[str]] = ["credits"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyRedeemablesItemGift 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, + ) + # set to None if credits (nullable) is None + # and model_fields_set contains the field + if self.credits is None and "credits" in self.model_fields_set: + _dict['credits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyRedeemablesItemGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "credits": obj.get("credits") + }) + return _obj + + diff --git a/voucherify/models/redemptions_redeem_request_body_redeemables_item_reward.py b/voucherify/models/redemptions_redeem_request_body_redeemables_item_reward.py new file mode 100644 index 00000000..66c71a88 --- /dev/null +++ b/voucherify/models/redemptions_redeem_request_body_redeemables_item_reward.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRedeemRequestBodyRedeemablesItemReward(BaseModel): + """ + Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.") + points: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card.") + __properties: ClassVar[List[str]] = ["id", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyRedeemablesItemReward 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRedeemRequestBodyRedeemablesItemReward 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"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/redemptions_redeem_response_body.py b/voucherify/models/redemptions_redeem_response_body.py new file mode 100644 index 00000000..c4e0964b --- /dev/null +++ b/voucherify/models/redemptions_redeem_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.redemption import Redemption +from voucherify.models.validations_redeemable_inapplicable import ValidationsRedeemableInapplicable +from voucherify.models.validations_redeemable_skipped import ValidationsRedeemableSkipped +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRedeemResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/redemptions`. + """ # noqa: E501 + redemptions: Optional[List[Redemption]] = None + parent_redemption: Optional[Redemption] = None + order: Optional[OrderCalculated] = None + inapplicable_redeemables: Optional[List[ValidationsRedeemableInapplicable]] = Field(default=None, description="Lists validation results of each inapplicable redeemable.") + skipped_redeemables: Optional[List[ValidationsRedeemableSkipped]] = Field(default=None, description="Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.") + __properties: ClassVar[List[str]] = ["redemptions", "parent_redemption", "order", "inapplicable_redeemables", "skipped_redeemables"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRedeemResponseBody 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 redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # override the default output from pydantic by calling `to_dict()` of parent_redemption + if self.parent_redemption: + _dict['parent_redemption'] = self.parent_redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in inapplicable_redeemables (list) + _items = [] + if self.inapplicable_redeemables: + for _item_inapplicable_redeemables in self.inapplicable_redeemables: + if _item_inapplicable_redeemables: + _items.append(_item_inapplicable_redeemables.to_dict()) + _dict['inapplicable_redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in skipped_redeemables (list) + _items = [] + if self.skipped_redeemables: + for _item_skipped_redeemables in self.skipped_redeemables: + if _item_skipped_redeemables: + _items.append(_item_skipped_redeemables.to_dict()) + _dict['skipped_redeemables'] = _items + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + # set to None if inapplicable_redeemables (nullable) is None + # and model_fields_set contains the field + if self.inapplicable_redeemables is None and "inapplicable_redeemables" in self.model_fields_set: + _dict['inapplicable_redeemables'] = None + + # set to None if skipped_redeemables (nullable) is None + # and model_fields_set contains the field + if self.skipped_redeemables is None and "skipped_redeemables" in self.model_fields_set: + _dict['skipped_redeemables'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRedeemResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redemptions": [Redemption.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None, + "parent_redemption": Redemption.from_dict(obj["parent_redemption"]) if obj.get("parent_redemption") is not None else None, + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "inapplicable_redeemables": [ValidationsRedeemableInapplicable.from_dict(_item) for _item in obj["inapplicable_redeemables"]] if obj.get("inapplicable_redeemables") is not None else None, + "skipped_redeemables": [ValidationsRedeemableSkipped.from_dict(_item) for _item in obj["skipped_redeemables"]] if obj.get("skipped_redeemables") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_request_body.py b/voucherify/models/redemptions_rollback_create_request_body.py new file mode 100644 index 00000000..4527f7c5 --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_request_body.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer import Customer +from voucherify.models.order import Order +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/redemptions/{redemptionId}/rollback`. + """ # noqa: E501 + reason: Optional[StrictStr] = Field(default=None, description="Reason for the rollback.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Customer's `source_id`.") + customer: Optional[Customer] = None + order: Optional[Order] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can send in the request body to update **redemption** metadata.") + __properties: ClassVar[List[str]] = ["reason", "tracking_id", "customer", "order", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reason": obj.get("reason"), + "tracking_id": obj.get("tracking_id"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_response_body.py b/voucherify/models/redemptions_rollback_create_response_body.py new file mode 100644 index 00000000..4e905787 --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_response_body.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated import OrderCalculated +from voucherify.models.promotion_tier import PromotionTier +from voucherify.models.redemption_reward_result import RedemptionRewardResult +from voucherify.models.redemptions_rollback_create_response_body_channel import RedemptionsRollbackCreateResponseBodyChannel +from voucherify.models.redemptions_rollback_create_response_body_gift import RedemptionsRollbackCreateResponseBodyGift +from voucherify.models.redemptions_rollback_create_response_body_loyalty_card import RedemptionsRollbackCreateResponseBodyLoyaltyCard +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions import RedemptionsRollbackCreateResponseBodyRelatedRedemptions +from voucherify.models.simple_customer import SimpleCustomer +from voucherify.models.voucher import Voucher +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/redemptions/{redemptionId}/rollback`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the redemption rollback.") + object: Optional[StrictStr] = Field(default='redemption_rollback', description="The type of the object represented by the JSON") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + customer_id: Optional[StrictStr] = Field(default=None, description="Unique customer ID of the redeeming customer.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the redemption.") + amount: Optional[StrictInt] = Field(default=None, description="For gift cards, this represents the number of the credits restored to the card in the rolledback redemption. The number is a negative integer in the smallest currency unit, e.g. -100 cents for $1.00 added back to the card. For loyalty cards, this represents the number of loyalty points restored to the card in the rolledback redemption. The number is a negative integer.") + redemption: Optional[StrictStr] = Field(default=None, description="Unique redemption ID of the parent redemption.") + reason: Optional[StrictStr] = Field(default=None, description="System generated cause for the redemption being invalid in the context of the provided parameters.") + result: Optional[StrictStr] = Field(default=None, description="Redemption result.") + status: Optional[StrictStr] = Field(default=None, description="Redemption status.") + related_redemptions: Optional[RedemptionsRollbackCreateResponseBodyRelatedRedemptions] = None + failure_code: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed.") + failure_message: Optional[StrictStr] = Field(default=None, description="If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed.") + order: Optional[OrderCalculated] = None + channel: Optional[RedemptionsRollbackCreateResponseBodyChannel] = None + customer: Optional[SimpleCustomer] = None + related_object_type: Optional[StrictStr] = Field(default=None, description="Defines the related object.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the related object. It is assigned by Voucherify, i.e. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher.") + voucher: Optional[Voucher] = None + promotion_tier: Optional[PromotionTier] = None + reward: Optional[RedemptionRewardResult] = None + gift: Optional[RedemptionsRollbackCreateResponseBodyGift] = None + loyalty_card: Optional[RedemptionsRollbackCreateResponseBodyLoyaltyCard] = None + __properties: ClassVar[List[str]] = ["id", "object", "date", "customer_id", "tracking_id", "metadata", "amount", "redemption", "reason", "result", "status", "related_redemptions", "failure_code", "failure_message", "order", "channel", "customer", "related_object_type", "related_object_id", "voucher", "promotion_tier", "reward", "gift", "loyalty_card"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption_rollback']): + raise ValueError("must be one of enum values ('redemption_rollback')") + return value + + @field_validator('result') + def result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAILURE']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAILURE')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCEEDED', 'FAILED']): + raise ValueError("must be one of enum values ('SUCCEEDED', 'FAILED')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'redemption']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'redemption')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBody 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 related_redemptions + if self.related_redemptions: + _dict['related_redemptions'] = self.related_redemptions.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of channel + if self.channel: + _dict['channel'] = self.channel.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of voucher + if self.voucher: + _dict['voucher'] = self.voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion_tier + if self.promotion_tier: + _dict['promotion_tier'] = self.promotion_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if var_date (nullable) is None + # and model_fields_set contains the field + if self.var_date is None and "var_date" in self.model_fields_set: + _dict['date'] = None + + # set to None if customer_id (nullable) is None + # and model_fields_set contains the field + if self.customer_id is None and "customer_id" in self.model_fields_set: + _dict['customer_id'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if related_redemptions (nullable) is None + # and model_fields_set contains the field + if self.related_redemptions is None and "related_redemptions" in self.model_fields_set: + _dict['related_redemptions'] = None + + # set to None if failure_code (nullable) is None + # and model_fields_set contains the field + if self.failure_code is None and "failure_code" in self.model_fields_set: + _dict['failure_code'] = None + + # set to None if failure_message (nullable) is None + # and model_fields_set contains the field + if self.failure_message is None and "failure_message" in self.model_fields_set: + _dict['failure_message'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'redemption_rollback', + "date": obj.get("date"), + "customer_id": obj.get("customer_id"), + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata"), + "amount": obj.get("amount"), + "redemption": obj.get("redemption"), + "reason": obj.get("reason"), + "result": obj.get("result"), + "status": obj.get("status"), + "related_redemptions": RedemptionsRollbackCreateResponseBodyRelatedRedemptions.from_dict(obj["related_redemptions"]) if obj.get("related_redemptions") is not None else None, + "failure_code": obj.get("failure_code"), + "failure_message": obj.get("failure_message"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "channel": RedemptionsRollbackCreateResponseBodyChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, + "customer": SimpleCustomer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "related_object_type": obj.get("related_object_type"), + "related_object_id": obj.get("related_object_id"), + "voucher": Voucher.from_dict(obj["voucher"]) if obj.get("voucher") is not None else None, + "promotion_tier": PromotionTier.from_dict(obj["promotion_tier"]) if obj.get("promotion_tier") is not None else None, + "reward": RedemptionRewardResult.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "gift": RedemptionsRollbackCreateResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": RedemptionsRollbackCreateResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_response_body_channel.py b/voucherify/models/redemptions_rollback_create_response_body_channel.py new file mode 100644 index 00000000..b39ef2ff --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_response_body_channel.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateResponseBodyChannel(BaseModel): + """ + Defines the details of the channel through which the redemption was issued. + """ # noqa: E501 + channel_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the channel which was used by the user performing the redemption rollback. This is either a user ID from the user using the Voucherify Dashboard or an X-APP-Id of a user using the API.") + channel_type: Optional[StrictStr] = Field(default=None, description="The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.") + __properties: ClassVar[List[str]] = ["channel_id", "channel_type"] + + @field_validator('channel_type') + def channel_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['USER', 'API']): + raise ValueError("must be one of enum values ('USER', 'API')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyChannel 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, + ) + # set to None if channel_id (nullable) is None + # and model_fields_set contains the field + if self.channel_id is None and "channel_id" in self.model_fields_set: + _dict['channel_id'] = None + + # set to None if channel_type (nullable) is None + # and model_fields_set contains the field + if self.channel_type is None and "channel_type" in self.model_fields_set: + _dict['channel_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyChannel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel_id": obj.get("channel_id"), + "channel_type": obj.get("channel_type") + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_response_body_gift.py b/voucherify/models/redemptions_rollback_create_response_body_gift.py new file mode 100644 index 00000000..6b426dc9 --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_response_body_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateResponseBodyGift(BaseModel): + """ + Contains the amount returned to the gift card in the redemption rollback. It is expressed as a negative integer. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Amount returned to the gift card as a result of the redemption rollback and expressed as a negative integer. The amount is expressed as the smallest currency unit (e.g. -100 cents for $1.00 returned).") + __properties: ClassVar[List[str]] = ["amount"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_response_body_loyalty_card.py b/voucherify/models/redemptions_rollback_create_response_body_loyalty_card.py new file mode 100644 index 00000000..6113d1da --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_response_body_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateResponseBodyLoyaltyCard(BaseModel): + """ + Contains the number of points returned to the loyalty card in the reward redemption rollback. It is expressed as a negative integer. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Number of points being returned to the loyalty card for the reward redemption rollback. It is expressed as a negative integer.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_response_body_related_redemptions.py b/voucherify/models/redemptions_rollback_create_response_body_related_redemptions.py new file mode 100644 index 00000000..1a9acf50 --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_response_body_related_redemptions.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions_redemptions_item import RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem +from voucherify.models.redemptions_rollback_create_response_body_related_redemptions_rollbacks_item import RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateResponseBodyRelatedRedemptions(BaseModel): + """ + RedemptionsRollbackCreateResponseBodyRelatedRedemptions + """ # noqa: E501 + rollbacks: Optional[List[RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem]] = None + redemptions: Optional[List[RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem]] = None + __properties: ClassVar[List[str]] = ["rollbacks", "redemptions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyRelatedRedemptions 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in redemptions (list) + _items = [] + if self.redemptions: + for _item_redemptions in self.redemptions: + if _item_redemptions: + _items.append(_item_redemptions.to_dict()) + _dict['redemptions'] = _items + # set to None if rollbacks (nullable) is None + # and model_fields_set contains the field + if self.rollbacks is None and "rollbacks" in self.model_fields_set: + _dict['rollbacks'] = None + + # set to None if redemptions (nullable) is None + # and model_fields_set contains the field + if self.redemptions is None and "redemptions" in self.model_fields_set: + _dict['redemptions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyRelatedRedemptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "redemptions": [RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem.from_dict(_item) for _item in obj["redemptions"]] if obj.get("redemptions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_response_body_related_redemptions_redemptions_item.py b/voucherify/models/redemptions_rollback_create_response_body_related_redemptions_redemptions_item.py new file mode 100644 index 00000000..4872af78 --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_response_body_related_redemptions_redemptions_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem(BaseModel): + """ + RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem 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 RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRedemptionsItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollback_create_response_body_related_redemptions_rollbacks_item.py b/voucherify/models/redemptions_rollback_create_response_body_related_redemptions_rollbacks_item.py new file mode 100644 index 00000000..d2f95fdd --- /dev/null +++ b/voucherify/models/redemptions_rollback_create_response_body_related_redemptions_rollbacks_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem(BaseModel): + """ + RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the redemption rollback.") + var_date: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the object was created. The value is shown in the ISO 8601 format.", alias="date") + __properties: ClassVar[List[str]] = ["id", "date"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem 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 RedemptionsRollbackCreateResponseBodyRelatedRedemptionsRollbacksItem 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"), + "date": obj.get("date") + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollbacks_create_request_body.py b/voucherify/models/redemptions_rollbacks_create_request_body.py new file mode 100644 index 00000000..61b89352 --- /dev/null +++ b/voucherify/models/redemptions_rollbacks_create_request_body.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer import Customer +from voucherify.models.order import Order +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbacksCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/redemptions/{parentRedemptionId}/rollbacks`. + """ # noqa: E501 + reason: Optional[StrictStr] = Field(default=None, description="Reason for the rollback.") + tracking_id: Optional[StrictStr] = Field(default=None, description="Customer's `source_id`.") + customer: Optional[Customer] = None + order: Optional[Order] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can send in the request body to update **redemption** metadata.") + __properties: ClassVar[List[str]] = ["reason", "tracking_id", "customer", "order", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbacksCreateRequestBody 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 customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbacksCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reason": obj.get("reason"), + "tracking_id": obj.get("tracking_id"), + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/redemptions_rollbacks_create_response_body.py b/voucherify/models/redemptions_rollbacks_create_response_body.py new file mode 100644 index 00000000..9162768e --- /dev/null +++ b/voucherify/models/redemptions_rollbacks_create_response_body.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.redemption_rollback import RedemptionRollback +from typing import Optional, Set +from typing_extensions import Self + +class RedemptionsRollbacksCreateResponseBody(BaseModel): + """ + Response body schema for POST `/redemptions/{parentRedemptionID}/rollbacks`. + """ # noqa: E501 + rollbacks: Optional[List[RedemptionRollback]] = Field(default=None, description="Contains the rollback redemption objects of the particular incentives.") + parent_rollback: Optional[RedemptionRollback] = None + order: Optional[OrderCalculated] = None + __properties: ClassVar[List[str]] = ["rollbacks", "parent_rollback", "order"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RedemptionsRollbacksCreateResponseBody 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 rollbacks (list) + _items = [] + if self.rollbacks: + for _item_rollbacks in self.rollbacks: + if _item_rollbacks: + _items.append(_item_rollbacks.to_dict()) + _dict['rollbacks'] = _items + # override the default output from pydantic by calling `to_dict()` of parent_rollback + if self.parent_rollback: + _dict['parent_rollback'] = self.parent_rollback.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # set to None if rollbacks (nullable) is None + # and model_fields_set contains the field + if self.rollbacks is None and "rollbacks" in self.model_fields_set: + _dict['rollbacks'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RedemptionsRollbacksCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "rollbacks": [RedemptionRollback.from_dict(_item) for _item in obj["rollbacks"]] if obj.get("rollbacks") is not None else None, + "parent_rollback": RedemptionRollback.from_dict(obj["parent_rollback"]) if obj.get("parent_rollback") is not None else None, + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None + }) + return _obj + + diff --git a/voucherify/models/referral_program.py b/voucherify/models/referral_program.py new file mode 100644 index 00000000..14e18722 --- /dev/null +++ b/voucherify/models/referral_program.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.referral_program_custom_event import ReferralProgramCustomEvent +from voucherify.models.referral_program_referee_reward import ReferralProgramRefereeReward +from typing import Optional, Set +from typing_extensions import Self + +class ReferralProgram(BaseModel): + """ + Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`. + """ # noqa: E501 + conversion_event_type: Optional[StrictStr] = Field(default=None, description="Define how a referral is triggered.") + custom_event: Optional[ReferralProgramCustomEvent] = None + referee_reward: Optional[ReferralProgramRefereeReward] = None + __properties: ClassVar[List[str]] = ["conversion_event_type", "custom_event", "referee_reward"] + + @field_validator('conversion_event_type') + def conversion_event_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['redemption', 'custom_event']): + raise ValueError("must be one of enum values ('redemption', 'custom_event')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferralProgram 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 custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of referee_reward + if self.referee_reward: + _dict['referee_reward'] = self.referee_reward.to_dict() + # set to None if conversion_event_type (nullable) is None + # and model_fields_set contains the field + if self.conversion_event_type is None and "conversion_event_type" in self.model_fields_set: + _dict['conversion_event_type'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if referee_reward (nullable) is None + # and model_fields_set contains the field + if self.referee_reward is None and "referee_reward" in self.model_fields_set: + _dict['referee_reward'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferralProgram from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conversion_event_type": obj.get("conversion_event_type"), + "custom_event": ReferralProgramCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "referee_reward": ReferralProgramRefereeReward.from_dict(obj["referee_reward"]) if obj.get("referee_reward") is not None else None + }) + return _obj + + diff --git a/voucherify/models/referral_program_custom_event.py b/voucherify/models/referral_program_custom_event.py new file mode 100644 index 00000000..f3808a21 --- /dev/null +++ b/voucherify/models/referral_program_custom_event.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReferralProgramCustomEvent(BaseModel): + """ + Contains details about the custom event. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique custom event ID.") + name: Optional[StrictStr] = Field(default=None, description="Custom event name.") + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferralProgramCustomEvent 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferralProgramCustomEvent 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/referral_program_referee_reward.py b/voucherify/models/referral_program_referee_reward.py new file mode 100644 index 00000000..4562b384 --- /dev/null +++ b/voucherify/models/referral_program_referee_reward.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.referral_program_referee_reward_related_object_parent import ReferralProgramRefereeRewardRelatedObjectParent +from typing import Optional, Set +from typing_extensions import Self + +class ReferralProgramRefereeReward(BaseModel): + """ + Defines the referee reward. + """ # noqa: E501 + related_object_parent: Optional[ReferralProgramRefereeRewardRelatedObjectParent] = None + type: Optional[StrictStr] = Field(default=None, description="Type of reward.") + amount: Optional[StrictStr] = Field(default=None, description="Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + __properties: ClassVar[List[str]] = ["related_object_parent", "type", "amount"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DISCOUNT_VOUCHER', 'LOYALTY_CARD', 'GIFT_VOUCHER', 'LUCKY_DRAW_CODE']): + raise ValueError("must be one of enum values ('DISCOUNT_VOUCHER', 'LOYALTY_CARD', 'GIFT_VOUCHER', 'LUCKY_DRAW_CODE')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferralProgramRefereeReward 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 related_object_parent + if self.related_object_parent: + _dict['related_object_parent'] = self.related_object_parent.to_dict() + # set to None if related_object_parent (nullable) is None + # and model_fields_set contains the field + if self.related_object_parent is None and "related_object_parent" in self.model_fields_set: + _dict['related_object_parent'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferralProgramRefereeReward from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "related_object_parent": ReferralProgramRefereeRewardRelatedObjectParent.from_dict(obj["related_object_parent"]) if obj.get("related_object_parent") is not None else None, + "type": obj.get("type"), + "amount": obj.get("amount") + }) + return _obj + + diff --git a/voucherify/models/referral_program_referee_reward_related_object_parent.py b/voucherify/models/referral_program_referee_reward_related_object_parent.py new file mode 100644 index 00000000..30a2cc1f --- /dev/null +++ b/voucherify/models/referral_program_referee_reward_related_object_parent.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ReferralProgramRefereeRewardRelatedObjectParent(BaseModel): + """ + Details of the resource from which the reward originates. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the reward source.") + name: Optional[StrictStr] = Field(default=None, description="Name of the reward source.") + object: Optional[StrictStr] = Field(default='CAMPAIGN', description="Type of resource represented by the source of the reward.") + __properties: ClassVar[List[str]] = ["id", "name", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CAMPAIGN']): + raise ValueError("must be one of enum values ('CAMPAIGN')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferralProgramRefereeRewardRelatedObjectParent 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferralProgramRefereeRewardRelatedObjectParent 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"), + "name": obj.get("name"), + "object": obj.get("object") if obj.get("object") is not None else 'CAMPAIGN' + }) + return _obj + + diff --git a/voucherify/models/referrer.py b/voucherify/models/referrer.py new file mode 100644 index 00000000..086238ae --- /dev/null +++ b/voucherify/models/referrer.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.referrer_address import ReferrerAddress +from typing import Optional, Set +from typing_extensions import Self + +class Referrer(BaseModel): + """ + Referrer + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The ID of an existing customer.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a customer object.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.") + birthday: Optional[date] = Field(default=None, description="`Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.") + birthdate: Optional[date] = Field(default=None, description="Customer's birthdate; format YYYY-MM-DD.") + address: Optional[ReferrerAddress] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "description", "email", "phone", "birthday", "birthdate", "address", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Referrer 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 address + if self.address: + _dict['address'] = self.address.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if phone (nullable) is None + # and model_fields_set contains the field + if self.phone is None and "phone" in self.model_fields_set: + _dict['phone'] = None + + # set to None if birthday (nullable) is None + # and model_fields_set contains the field + if self.birthday is None and "birthday" in self.model_fields_set: + _dict['birthday'] = None + + # set to None if birthdate (nullable) is None + # and model_fields_set contains the field + if self.birthdate is None and "birthdate" in self.model_fields_set: + _dict['birthdate'] = None + + # set to None if address (nullable) is None + # and model_fields_set contains the field + if self.address is None and "address" in self.model_fields_set: + _dict['address'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Referrer 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "description": obj.get("description"), + "email": obj.get("email"), + "phone": obj.get("phone"), + "birthday": obj.get("birthday"), + "birthdate": obj.get("birthdate"), + "address": ReferrerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/referrer_address.py b/voucherify/models/referrer_address.py new file mode 100644 index 00000000..9c1c9511 --- /dev/null +++ b/voucherify/models/referrer_address.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReferrerAddress(BaseModel): + """ + Customer's address. + """ # noqa: E501 + city: Optional[StrictStr] = Field(default=None, description="City") + state: Optional[StrictStr] = Field(default=None, description="State") + line_1: Optional[StrictStr] = Field(default=None, description="First line of address.") + line_2: Optional[StrictStr] = Field(default=None, description="Second line of address.") + country: Optional[StrictStr] = Field(default=None, description="Country.") + postal_code: Optional[StrictStr] = Field(default=None, description="Postal code.") + __properties: ClassVar[List[str]] = ["city", "state", "line_1", "line_2", "country", "postal_code"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferrerAddress 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, + ) + # set to None if city (nullable) is None + # and model_fields_set contains the field + if self.city is None and "city" in self.model_fields_set: + _dict['city'] = None + + # set to None if state (nullable) is None + # and model_fields_set contains the field + if self.state is None and "state" in self.model_fields_set: + _dict['state'] = None + + # set to None if line_1 (nullable) is None + # and model_fields_set contains the field + if self.line_1 is None and "line_1" in self.model_fields_set: + _dict['line_1'] = None + + # set to None if line_2 (nullable) is None + # and model_fields_set contains the field + if self.line_2 is None and "line_2" in self.model_fields_set: + _dict['line_2'] = None + + # set to None if country (nullable) is None + # and model_fields_set contains the field + if self.country is None and "country" in self.model_fields_set: + _dict['country'] = None + + # set to None if postal_code (nullable) is None + # and model_fields_set contains the field + if self.postal_code is None and "postal_code" in self.model_fields_set: + _dict['postal_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferrerAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "city": obj.get("city"), + "state": obj.get("state"), + "line_1": obj.get("line_1"), + "line_2": obj.get("line_2"), + "country": obj.get("country"), + "postal_code": obj.get("postal_code") + }) + return _obj + + diff --git a/voucherify/models/referrer_id.py b/voucherify/models/referrer_id.py new file mode 100644 index 00000000..45b9d7a5 --- /dev/null +++ b/voucherify/models/referrer_id.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ReferrerId(BaseModel): + """ + ReferrerId + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier of an existing customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferrerId 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferrerId 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"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/resource_types.py b/voucherify/models/resource_types.py new file mode 100644 index 00000000..178ebe77 --- /dev/null +++ b/voucherify/models/resource_types.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ResourceTypes(str, Enum): + """ + Types of usable resources. + """ + + """ + allowed enum values + """ + CAMPAIGN = 'campaign' + VOUCHER = 'voucher' + PROMOTION_TIER = 'promotion_tier' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ResourceTypes from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/voucherify/models/reward.py b/voucherify/models/reward.py new file mode 100644 index 00000000..a26256d2 --- /dev/null +++ b/voucherify/models/reward.py @@ -0,0 +1,179 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.reward_attributes import RewardAttributes +from voucherify.models.reward_type import RewardType +from typing import Optional, Set +from typing_extensions import Self + +class Reward(BaseModel): + """ + Reward + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + stock: Optional[StrictInt] = Field(default=None, description="Configurable for **material rewards**. The number of units of the product that you want to share as reward.") + redeemed: Optional[StrictInt] = Field(default=None, description="Defines the number of already invoked (successful) reward redemptions. ") + attributes: Optional[RewardAttributes] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format.") + type: Optional[StrictStr] = Field(default=None, description="Reward type.") + parameters: Optional[RewardType] = None + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format.") + object: StrictStr = Field(description="The type of the object represented by the JSON. This object stores information about the reward.") + __properties: ClassVar[List[str]] = ["id", "name", "stock", "redeemed", "attributes", "metadata", "type", "parameters", "created_at", "updated_at", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CAMPAIGN', 'COIN', 'MATERIAL']): + raise ValueError("must be one of enum values ('CAMPAIGN', 'COIN', 'MATERIAL')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['reward']): + raise ValueError("must be one of enum values ('reward')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Reward 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 attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if stock (nullable) is None + # and model_fields_set contains the field + if self.stock is None and "stock" in self.model_fields_set: + _dict['stock'] = None + + # set to None if redeemed (nullable) is None + # and model_fields_set contains the field + if self.redeemed is None and "redeemed" in self.model_fields_set: + _dict['redeemed'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Reward 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"), + "name": obj.get("name"), + "stock": obj.get("stock"), + "redeemed": obj.get("redeemed"), + "attributes": RewardAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": obj.get("metadata"), + "type": obj.get("type"), + "parameters": RewardType.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward' + }) + return _obj + + diff --git a/voucherify/models/reward_assignment.py b/voucherify/models/reward_assignment.py new file mode 100644 index 00000000..29087060 --- /dev/null +++ b/voucherify/models/reward_assignment.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.reward_assignment_parameters import RewardAssignmentParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardAssignment(BaseModel): + """ + RewardAssignment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[RewardAssignmentParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardAssignment 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardAssignment 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": RewardAssignmentParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/reward_assignment_parameters.py b/voucherify/models/reward_assignment_parameters.py new file mode 100644 index 00000000..8b92b492 --- /dev/null +++ b/voucherify/models/reward_assignment_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.reward_assignment_parameters_loyalty import RewardAssignmentParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class RewardAssignmentParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[RewardAssignmentParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardAssignmentParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardAssignmentParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": RewardAssignmentParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/reward_assignment_parameters_loyalty.py b/voucherify/models/reward_assignment_parameters_loyalty.py new file mode 100644 index 00000000..cd6020f4 --- /dev/null +++ b/voucherify/models/reward_assignment_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardAssignmentParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardAssignmentParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardAssignmentParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/reward_attributes.py b/voucherify/models/reward_attributes.py new file mode 100644 index 00000000..b7d38448 --- /dev/null +++ b/voucherify/models/reward_attributes.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardAttributes(BaseModel): + """ + These properties are configurable for **material rewards**. + """ # noqa: E501 + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a material reward.") + __properties: ClassVar[List[str]] = ["image_url", "description"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardAttributes 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, + ) + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "image_url": obj.get("image_url"), + "description": obj.get("description") + }) + return _obj + + diff --git a/voucherify/models/reward_type.py b/voucherify/models/reward_type.py new file mode 100644 index 00000000..4995d81a --- /dev/null +++ b/voucherify/models/reward_type.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.reward_type_campaign import RewardTypeCampaign +from voucherify.models.reward_type_coin import RewardTypeCoin +from voucherify.models.reward_type_product import RewardTypeProduct +from typing import Optional, Set +from typing_extensions import Self + +class RewardType(BaseModel): + """ + RewardType + """ # noqa: E501 + campaign: Optional[RewardTypeCampaign] = None + coin: Optional[RewardTypeCoin] = None + product: Optional[RewardTypeProduct] = None + __properties: ClassVar[List[str]] = ["campaign", "coin", "product"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardType 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 campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of coin + if self.coin: + _dict['coin'] = self.coin.to_dict() + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict['product'] = self.product.to_dict() + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if coin (nullable) is None + # and model_fields_set contains the field + if self.coin is None and "coin" in self.model_fields_set: + _dict['coin'] = None + + # set to None if product (nullable) is None + # and model_fields_set contains the field + if self.product is None and "product" in self.model_fields_set: + _dict['product'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "campaign": RewardTypeCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "coin": RewardTypeCoin.from_dict(obj["coin"]) if obj.get("coin") is not None else None, + "product": RewardTypeProduct.from_dict(obj["product"]) if obj.get("product") is not None else None + }) + return _obj + + diff --git a/voucherify/models/reward_type_campaign.py b/voucherify/models/reward_type_campaign.py new file mode 100644 index 00000000..b74f4c26 --- /dev/null +++ b/voucherify/models/reward_type_campaign.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class RewardTypeCampaign(BaseModel): + """ + Objects stores information about the campaign related to the reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique campaign ID, assigned by Voucherify.") + balance: Optional[StrictInt] = Field(default=None, description="The number of points to be added to a loyalty card or the amount to be added to the current balance on the gift card. For gift cards, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + type: Optional[StrictStr] = Field(default=None, description="Campaign type.") + __properties: ClassVar[List[str]] = ["id", "balance", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DISCOUNT_COUPONS', 'GIFT_VOUCHERS', 'LOYALTY_PROGRAM']): + raise ValueError("must be one of enum values ('DISCOUNT_COUPONS', 'GIFT_VOUCHERS', 'LOYALTY_PROGRAM')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardTypeCampaign 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardTypeCampaign 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"), + "balance": obj.get("balance"), + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/reward_type_coin.py b/voucherify/models/reward_type_coin.py new file mode 100644 index 00000000..5430bf3e --- /dev/null +++ b/voucherify/models/reward_type_coin.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class RewardTypeCoin(BaseModel): + """ + Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio. + """ # noqa: E501 + exchange_ratio: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The cash equivalent of the points defined in the points_ratio property.") + points_ratio: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property.") + __properties: ClassVar[List[str]] = ["exchange_ratio", "points_ratio"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardTypeCoin 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, + ) + # set to None if exchange_ratio (nullable) is None + # and model_fields_set contains the field + if self.exchange_ratio is None and "exchange_ratio" in self.model_fields_set: + _dict['exchange_ratio'] = None + + # set to None if points_ratio (nullable) is None + # and model_fields_set contains the field + if self.points_ratio is None and "points_ratio" in self.model_fields_set: + _dict['points_ratio'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardTypeCoin from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "exchange_ratio": obj.get("exchange_ratio"), + "points_ratio": obj.get("points_ratio") + }) + return _obj + + diff --git a/voucherify/models/reward_type_product.py b/voucherify/models/reward_type_product.py new file mode 100644 index 00000000..2a571f87 --- /dev/null +++ b/voucherify/models/reward_type_product.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardTypeProduct(BaseModel): + """ + Contains information about the product given as a reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID, assigned by Voucherify.") + sku_id: Optional[StrictStr] = Field(default=None, description="Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.") + __properties: ClassVar[List[str]] = ["id", "sku_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardTypeProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if sku_id (nullable) is None + # and model_fields_set contains the field + if self.sku_id is None and "sku_id" in self.model_fields_set: + _dict['sku_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardTypeProduct 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"), + "sku_id": obj.get("sku_id") + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_create_request_body.py b/voucherify/models/rewards_assignments_create_request_body.py new file mode 100644 index 00000000..5d7c80ef --- /dev/null +++ b/voucherify/models/rewards_assignments_create_request_body.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_create_request_body_parameters import RewardsAssignmentsCreateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsCreateRequestBody(BaseModel): + """ + RewardsAssignmentsCreateRequestBody + """ # noqa: E501 + campaign: Optional[StrictStr] = Field(default=None, description="The campaign ID of the campaign to which the reward is to be assigned.") + parameters: Optional[RewardsAssignmentsCreateRequestBodyParameters] = None + validation_rules: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["campaign", "parameters", "validation_rules"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + # set to None if validation_rules (nullable) is None + # and model_fields_set contains the field + if self.validation_rules is None and "validation_rules" in self.model_fields_set: + _dict['validation_rules'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "campaign": obj.get("campaign"), + "parameters": RewardsAssignmentsCreateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "validation_rules": obj.get("validation_rules") + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_create_request_body_parameters.py b/voucherify/models/rewards_assignments_create_request_body_parameters.py new file mode 100644 index 00000000..ebd71a36 --- /dev/null +++ b/voucherify/models/rewards_assignments_create_request_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_create_request_body_parameters_loyalty import RewardsAssignmentsCreateRequestBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsCreateRequestBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[RewardsAssignmentsCreateRequestBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateRequestBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": RewardsAssignmentsCreateRequestBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_create_request_body_parameters_loyalty.py b/voucherify/models/rewards_assignments_create_request_body_parameters_loyalty.py new file mode 100644 index 00000000..afd7b918 --- /dev/null +++ b/voucherify/models/rewards_assignments_create_request_body_parameters_loyalty.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsCreateRequestBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed. Must be positive integer.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateRequestBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateRequestBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_create_response_body.py b/voucherify/models/rewards_assignments_create_response_body.py new file mode 100644 index 00000000..10e373cb --- /dev/null +++ b/voucherify/models/rewards_assignments_create_response_body.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_create_response_body_parameters import RewardsAssignmentsCreateResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsCreateResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[RewardsAssignmentsCreateResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateResponseBody 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": RewardsAssignmentsCreateResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_create_response_body_parameters.py b/voucherify/models/rewards_assignments_create_response_body_parameters.py new file mode 100644 index 00000000..9622c99a --- /dev/null +++ b/voucherify/models/rewards_assignments_create_response_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_create_response_body_parameters_loyalty import RewardsAssignmentsCreateResponseBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsCreateResponseBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[RewardsAssignmentsCreateResponseBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateResponseBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": RewardsAssignmentsCreateResponseBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_create_response_body_parameters_loyalty.py b/voucherify/models/rewards_assignments_create_response_body_parameters_loyalty.py new file mode 100644 index 00000000..b840486e --- /dev/null +++ b/voucherify/models/rewards_assignments_create_response_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsCreateResponseBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateResponseBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsCreateResponseBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_get_response_body.py b/voucherify/models/rewards_assignments_get_response_body.py new file mode 100644 index 00000000..9619502c --- /dev/null +++ b/voucherify/models/rewards_assignments_get_response_body.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_get_response_body_parameters import RewardsAssignmentsGetResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[RewardsAssignmentsGetResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsGetResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsGetResponseBody 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": RewardsAssignmentsGetResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_get_response_body_parameters.py b/voucherify/models/rewards_assignments_get_response_body_parameters.py new file mode 100644 index 00000000..a3ce1673 --- /dev/null +++ b/voucherify/models/rewards_assignments_get_response_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_get_response_body_parameters_loyalty import RewardsAssignmentsGetResponseBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsGetResponseBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[RewardsAssignmentsGetResponseBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsGetResponseBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsGetResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": RewardsAssignmentsGetResponseBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_get_response_body_parameters_loyalty.py b/voucherify/models/rewards_assignments_get_response_body_parameters_loyalty.py new file mode 100644 index 00000000..afea0a27 --- /dev/null +++ b/voucherify/models/rewards_assignments_get_response_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsGetResponseBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsGetResponseBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsGetResponseBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_list_response_body.py b/voucherify/models/rewards_assignments_list_response_body.py new file mode 100644 index 00000000..248b3302 --- /dev/null +++ b/voucherify/models/rewards_assignments_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.reward_assignment import RewardAssignment +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/rewards/{rewardID}/assignments`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about reward assignments in a dictionary.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of reward assignments.") + data: Optional[List[RewardAssignment]] = None + total: Optional[StrictInt] = Field(default=None, description="Total number of reward assignments.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [RewardAssignment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_update_request_body.py b/voucherify/models/rewards_assignments_update_request_body.py new file mode 100644 index 00000000..259a3e2a --- /dev/null +++ b/voucherify/models/rewards_assignments_update_request_body.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_update_request_body_parameters import RewardsAssignmentsUpdateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsUpdateRequestBody(BaseModel): + """ + Request body schema for **PUT** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + """ # noqa: E501 + parameters: Optional[RewardsAssignmentsUpdateRequestBodyParameters] = None + __properties: ClassVar[List[str]] = ["parameters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parameters": RewardsAssignmentsUpdateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_update_request_body_parameters.py b/voucherify/models/rewards_assignments_update_request_body_parameters.py new file mode 100644 index 00000000..bdedb8be --- /dev/null +++ b/voucherify/models/rewards_assignments_update_request_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_update_request_body_parameters_loyalty import RewardsAssignmentsUpdateRequestBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsUpdateRequestBodyParameters(BaseModel): + """ + An object that defines the price of the reward in loyalty points. + """ # noqa: E501 + loyalty: Optional[RewardsAssignmentsUpdateRequestBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateRequestBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": RewardsAssignmentsUpdateRequestBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_update_request_body_parameters_loyalty.py b/voucherify/models/rewards_assignments_update_request_body_parameters_loyalty.py new file mode 100644 index 00000000..1943a14e --- /dev/null +++ b/voucherify/models/rewards_assignments_update_request_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsUpdateRequestBodyParametersLoyalty(BaseModel): + """ + Stores the points parameter. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Defines how many points are required to obtain the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateRequestBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateRequestBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_update_response_body.py b/voucherify/models/rewards_assignments_update_response_body.py new file mode 100644 index 00000000..95977aa2 --- /dev/null +++ b/voucherify/models/rewards_assignments_update_response_body.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_update_response_body_parameters import RewardsAssignmentsUpdateResponseBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsUpdateResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/rewards/{rewardId}/assignments/{assignmentId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward assignment ID, assigned by Voucherify.") + reward_id: Optional[StrictStr] = Field(default=None, description="Associated reward ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward assignment was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='reward_assignment', description="The type of the object represented by the JSON. This object stores information about the reward assignment.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Related object ID to which the reward was assigned.") + related_object_type: Optional[StrictStr] = Field(default='campaign', description="Related object type to which the reward was assigned.") + parameters: Optional[RewardsAssignmentsUpdateResponseBodyParameters] = None + __properties: ClassVar[List[str]] = ["id", "reward_id", "created_at", "updated_at", "object", "related_object_id", "related_object_type", "parameters"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['reward_assignment']): + raise ValueError("must be one of enum values ('reward_assignment')") + return value + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['campaign']): + raise ValueError("must be one of enum values ('campaign')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if reward_id (nullable) is None + # and model_fields_set contains the field + if self.reward_id is None and "reward_id" in self.model_fields_set: + _dict['reward_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateResponseBody 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"), + "reward_id": obj.get("reward_id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward_assignment', + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'campaign', + "parameters": RewardsAssignmentsUpdateResponseBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_update_response_body_parameters.py b/voucherify/models/rewards_assignments_update_response_body_parameters.py new file mode 100644 index 00000000..0ef89cbd --- /dev/null +++ b/voucherify/models/rewards_assignments_update_response_body_parameters.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_assignments_update_response_body_parameters_loyalty import RewardsAssignmentsUpdateResponseBodyParametersLoyalty +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsUpdateResponseBodyParameters(BaseModel): + """ + Defines the cost of the reward. + """ # noqa: E501 + loyalty: Optional[RewardsAssignmentsUpdateResponseBodyParametersLoyalty] = None + __properties: ClassVar[List[str]] = ["loyalty"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateResponseBodyParameters 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 loyalty + if self.loyalty: + _dict['loyalty'] = self.loyalty.to_dict() + # set to None if loyalty (nullable) is None + # and model_fields_set contains the field + if self.loyalty is None and "loyalty" in self.model_fields_set: + _dict['loyalty'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateResponseBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "loyalty": RewardsAssignmentsUpdateResponseBodyParametersLoyalty.from_dict(obj["loyalty"]) if obj.get("loyalty") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_assignments_update_response_body_parameters_loyalty.py b/voucherify/models/rewards_assignments_update_response_body_parameters_loyalty.py new file mode 100644 index 00000000..4135d669 --- /dev/null +++ b/voucherify/models/rewards_assignments_update_response_body_parameters_loyalty.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsAssignmentsUpdateResponseBodyParametersLoyalty(BaseModel): + """ + Defines the equivalent points value of the reward. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="The number of points required to redeem the reward.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateResponseBodyParametersLoyalty 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsAssignmentsUpdateResponseBodyParametersLoyalty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/rewards_create_request_body.py b/voucherify/models/rewards_create_request_body.py new file mode 100644 index 00000000..46dee521 --- /dev/null +++ b/voucherify/models/rewards_create_request_body.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_create_request_body_attributes import RewardsCreateRequestBodyAttributes +from voucherify.models.rewards_create_request_body_parameters import RewardsCreateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateRequestBody(BaseModel): + """ + RewardsCreateRequestBody + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + parameters: Optional[RewardsCreateRequestBodyParameters] = None + metadata: Optional[Dict[str, Any]] = None + stock: Optional[StrictInt] = Field(default=None, description="The number of units of the product that you want to share as a reward.") + attributes: Optional[RewardsCreateRequestBodyAttributes] = None + __properties: ClassVar[List[str]] = ["name", "parameters", "metadata", "stock", "attributes"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if stock (nullable) is None + # and model_fields_set contains the field + if self.stock is None and "stock" in self.model_fields_set: + _dict['stock'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBody 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"), + "parameters": RewardsCreateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "metadata": obj.get("metadata"), + "stock": obj.get("stock"), + "attributes": RewardsCreateRequestBodyAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_create_request_body_attributes.py b/voucherify/models/rewards_create_request_body_attributes.py new file mode 100644 index 00000000..68742217 --- /dev/null +++ b/voucherify/models/rewards_create_request_body_attributes.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateRequestBodyAttributes(BaseModel): + """ + Attributes of a material reward. + """ # noqa: E501 + image_url: Optional[StrictStr] = Field(default=None, description="HTTPS URL pointing to a .png or .jpg file.") + description: Optional[StrictStr] = Field(default=None, description="Description of a material reward.") + __properties: ClassVar[List[str]] = ["image_url", "description"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyAttributes 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, + ) + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "image_url": obj.get("image_url"), + "description": obj.get("description") + }) + return _obj + + diff --git a/voucherify/models/rewards_create_request_body_parameters.py b/voucherify/models/rewards_create_request_body_parameters.py new file mode 100644 index 00000000..fe20756f --- /dev/null +++ b/voucherify/models/rewards_create_request_body_parameters.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_create_request_body_parameters_campaign import RewardsCreateRequestBodyParametersCampaign +from voucherify.models.rewards_create_request_body_parameters_coin import RewardsCreateRequestBodyParametersCoin +from voucherify.models.rewards_create_request_body_parameters_product import RewardsCreateRequestBodyParametersProduct +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateRequestBodyParameters(BaseModel): + """ + RewardsCreateRequestBodyParameters + """ # noqa: E501 + campaign: Optional[RewardsCreateRequestBodyParametersCampaign] = None + product: Optional[RewardsCreateRequestBodyParametersProduct] = None + coin: Optional[RewardsCreateRequestBodyParametersCoin] = None + __properties: ClassVar[List[str]] = ["campaign", "product", "coin"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParameters 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 campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of coin + if self.coin: + _dict['coin'] = self.coin.to_dict() + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if product (nullable) is None + # and model_fields_set contains the field + if self.product is None and "product" in self.model_fields_set: + _dict['product'] = None + + # set to None if coin (nullable) is None + # and model_fields_set contains the field + if self.coin is None and "coin" in self.model_fields_set: + _dict['coin'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "campaign": RewardsCreateRequestBodyParametersCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "product": RewardsCreateRequestBodyParametersProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, + "coin": RewardsCreateRequestBodyParametersCoin.from_dict(obj["coin"]) if obj.get("coin") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_create_request_body_parameters_campaign.py b/voucherify/models/rewards_create_request_body_parameters_campaign.py new file mode 100644 index 00000000..8368f8c4 --- /dev/null +++ b/voucherify/models/rewards_create_request_body_parameters_campaign.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateRequestBodyParametersCampaign(BaseModel): + """ + RewardsCreateRequestBodyParametersCampaign + """ # noqa: E501 + id: Optional[StrictStr] = None + balance: Optional[StrictInt] = Field(default=None, description="The incremental points to be added to the current balance on the loyalty card. and The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + __properties: ClassVar[List[str]] = ["id", "balance"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParametersCampaign 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParametersCampaign 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"), + "balance": obj.get("balance") + }) + return _obj + + diff --git a/voucherify/models/rewards_create_request_body_parameters_coin.py b/voucherify/models/rewards_create_request_body_parameters_coin.py new file mode 100644 index 00000000..73fb2a03 --- /dev/null +++ b/voucherify/models/rewards_create_request_body_parameters_coin.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateRequestBodyParametersCoin(BaseModel): + """ + Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + """ # noqa: E501 + exchange_ratio: Optional[StrictStr] = Field(default=None, description="The cash equivalent of the points defined in the `points_ratio` property.") + points_ratio: Optional[StrictStr] = Field(default=None, description="The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property.") + __properties: ClassVar[List[str]] = ["exchange_ratio", "points_ratio"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParametersCoin 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, + ) + # set to None if exchange_ratio (nullable) is None + # and model_fields_set contains the field + if self.exchange_ratio is None and "exchange_ratio" in self.model_fields_set: + _dict['exchange_ratio'] = None + + # set to None if points_ratio (nullable) is None + # and model_fields_set contains the field + if self.points_ratio is None and "points_ratio" in self.model_fields_set: + _dict['points_ratio'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParametersCoin from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "exchange_ratio": obj.get("exchange_ratio"), + "points_ratio": obj.get("points_ratio") + }) + return _obj + + diff --git a/voucherify/models/rewards_create_request_body_parameters_product.py b/voucherify/models/rewards_create_request_body_parameters_product.py new file mode 100644 index 00000000..7a0c3f3d --- /dev/null +++ b/voucherify/models/rewards_create_request_body_parameters_product.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateRequestBodyParametersProduct(BaseModel): + """ + Define the product given as a reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID, assigned by Voucherify, given as a reward.") + sku_id: Optional[StrictStr] = Field(default=None, description="Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.") + __properties: ClassVar[List[str]] = ["id", "sku_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParametersProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if sku_id (nullable) is None + # and model_fields_set contains the field + if self.sku_id is None and "sku_id" in self.model_fields_set: + _dict['sku_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateRequestBodyParametersProduct 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"), + "sku_id": obj.get("sku_id") + }) + return _obj + + diff --git a/voucherify/models/rewards_create_response_body.py b/voucherify/models/rewards_create_response_body.py new file mode 100644 index 00000000..47188445 --- /dev/null +++ b/voucherify/models/rewards_create_response_body.py @@ -0,0 +1,179 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.reward_type import RewardType +from voucherify.models.rewards_create_response_body_attributes import RewardsCreateResponseBodyAttributes +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/rewards`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + stock: Optional[StrictInt] = Field(default=None, description="Configurable for **material rewards**. The number of units of the product that you want to share as reward.") + redeemed: Optional[StrictInt] = Field(default=None, description="Defines the number of already invoked (successful) reward redemptions. ") + attributes: Optional[RewardsCreateResponseBodyAttributes] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format.") + type: Optional[StrictStr] = Field(default=None, description="Reward type.") + parameters: Optional[RewardType] = None + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format.") + object: StrictStr = Field(description="The type of the object represented by the JSON. This object stores information about the reward.") + __properties: ClassVar[List[str]] = ["id", "name", "stock", "redeemed", "attributes", "metadata", "type", "parameters", "created_at", "updated_at", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CAMPAIGN', 'COIN', 'MATERIAL']): + raise ValueError("must be one of enum values ('CAMPAIGN', 'COIN', 'MATERIAL')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['reward']): + raise ValueError("must be one of enum values ('reward')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateResponseBody 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 attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if stock (nullable) is None + # and model_fields_set contains the field + if self.stock is None and "stock" in self.model_fields_set: + _dict['stock'] = None + + # set to None if redeemed (nullable) is None + # and model_fields_set contains the field + if self.redeemed is None and "redeemed" in self.model_fields_set: + _dict['redeemed'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateResponseBody 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"), + "name": obj.get("name"), + "stock": obj.get("stock"), + "redeemed": obj.get("redeemed"), + "attributes": RewardsCreateResponseBodyAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": obj.get("metadata"), + "type": obj.get("type"), + "parameters": RewardType.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward' + }) + return _obj + + diff --git a/voucherify/models/rewards_create_response_body_attributes.py b/voucherify/models/rewards_create_response_body_attributes.py new file mode 100644 index 00000000..07708e97 --- /dev/null +++ b/voucherify/models/rewards_create_response_body_attributes.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsCreateResponseBodyAttributes(BaseModel): + """ + These properties are configurable for **material rewards**. + """ # noqa: E501 + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a material reward.") + __properties: ClassVar[List[str]] = ["image_url", "description"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsCreateResponseBodyAttributes 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, + ) + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsCreateResponseBodyAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "image_url": obj.get("image_url"), + "description": obj.get("description") + }) + return _obj + + diff --git a/voucherify/models/rewards_list_response_body.py b/voucherify/models/rewards_list_response_body.py new file mode 100644 index 00000000..0c0c5c3a --- /dev/null +++ b/voucherify/models/rewards_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.reward import Reward +from typing import Optional, Set +from typing_extensions import Self + +class RewardsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/rewards`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of transaction objects.") + data: Optional[List[Reward]] = Field(default=None, description="A dictionary that contains an array of rewards. Each entry in the array is a separate transaction object.") + total: Optional[StrictInt] = Field(default=None, description="Returns how many rewards in the project meet the limits defined by the query parameter definitions.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [Reward.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/rewards_update_request_body.py b/voucherify/models/rewards_update_request_body.py new file mode 100644 index 00000000..42ae7d22 --- /dev/null +++ b/voucherify/models/rewards_update_request_body.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_update_request_body_attributes import RewardsUpdateRequestBodyAttributes +from voucherify.models.rewards_update_request_body_parameters import RewardsUpdateRequestBodyParameters +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateRequestBody(BaseModel): + """ + RewardsUpdateRequestBody + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + parameters: Optional[RewardsUpdateRequestBodyParameters] = None + metadata: Optional[Dict[str, Any]] = None + stock: Optional[StrictInt] = Field(default=None, description="The number of units of the product that you want to share as a reward.") + attributes: Optional[RewardsUpdateRequestBodyAttributes] = None + __properties: ClassVar[List[str]] = ["name", "parameters", "metadata", "stock", "attributes"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if parameters (nullable) is None + # and model_fields_set contains the field + if self.parameters is None and "parameters" in self.model_fields_set: + _dict['parameters'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if stock (nullable) is None + # and model_fields_set contains the field + if self.stock is None and "stock" in self.model_fields_set: + _dict['stock'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBody 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"), + "parameters": RewardsUpdateRequestBodyParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "metadata": obj.get("metadata"), + "stock": obj.get("stock"), + "attributes": RewardsUpdateRequestBodyAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_update_request_body_attributes.py b/voucherify/models/rewards_update_request_body_attributes.py new file mode 100644 index 00000000..f6c59c33 --- /dev/null +++ b/voucherify/models/rewards_update_request_body_attributes.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateRequestBodyAttributes(BaseModel): + """ + Attributes of a material reward. + """ # noqa: E501 + image_url: Optional[StrictStr] = Field(default=None, description="HTTPS URL pointing to a .png or .jpg file.") + description: Optional[StrictStr] = Field(default=None, description="Description of a material reward.") + __properties: ClassVar[List[str]] = ["image_url", "description"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyAttributes 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, + ) + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "image_url": obj.get("image_url"), + "description": obj.get("description") + }) + return _obj + + diff --git a/voucherify/models/rewards_update_request_body_parameters.py b/voucherify/models/rewards_update_request_body_parameters.py new file mode 100644 index 00000000..9d7d0101 --- /dev/null +++ b/voucherify/models/rewards_update_request_body_parameters.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.rewards_update_request_body_parameters_campaign import RewardsUpdateRequestBodyParametersCampaign +from voucherify.models.rewards_update_request_body_parameters_coin import RewardsUpdateRequestBodyParametersCoin +from voucherify.models.rewards_update_request_body_parameters_product import RewardsUpdateRequestBodyParametersProduct +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateRequestBodyParameters(BaseModel): + """ + RewardsUpdateRequestBodyParameters + """ # noqa: E501 + campaign: Optional[RewardsUpdateRequestBodyParametersCampaign] = None + product: Optional[RewardsUpdateRequestBodyParametersProduct] = None + coin: Optional[RewardsUpdateRequestBodyParametersCoin] = None + __properties: ClassVar[List[str]] = ["campaign", "product", "coin"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParameters 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 campaign + if self.campaign: + _dict['campaign'] = self.campaign.to_dict() + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of coin + if self.coin: + _dict['coin'] = self.coin.to_dict() + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if product (nullable) is None + # and model_fields_set contains the field + if self.product is None and "product" in self.model_fields_set: + _dict['product'] = None + + # set to None if coin (nullable) is None + # and model_fields_set contains the field + if self.coin is None and "coin" in self.model_fields_set: + _dict['coin'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "campaign": RewardsUpdateRequestBodyParametersCampaign.from_dict(obj["campaign"]) if obj.get("campaign") is not None else None, + "product": RewardsUpdateRequestBodyParametersProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, + "coin": RewardsUpdateRequestBodyParametersCoin.from_dict(obj["coin"]) if obj.get("coin") is not None else None + }) + return _obj + + diff --git a/voucherify/models/rewards_update_request_body_parameters_campaign.py b/voucherify/models/rewards_update_request_body_parameters_campaign.py new file mode 100644 index 00000000..d6122c8a --- /dev/null +++ b/voucherify/models/rewards_update_request_body_parameters_campaign.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateRequestBodyParametersCampaign(BaseModel): + """ + RewardsUpdateRequestBodyParametersCampaign + """ # noqa: E501 + id: Optional[StrictStr] = None + balance: Optional[StrictInt] = Field(default=None, description="The incremental points to be added to the current balance on the loyalty card. and The incremental amount to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + __properties: ClassVar[List[str]] = ["id", "balance"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParametersCampaign 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParametersCampaign 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"), + "balance": obj.get("balance") + }) + return _obj + + diff --git a/voucherify/models/rewards_update_request_body_parameters_coin.py b/voucherify/models/rewards_update_request_body_parameters_coin.py new file mode 100644 index 00000000..e3fd2f10 --- /dev/null +++ b/voucherify/models/rewards_update_request_body_parameters_coin.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateRequestBodyParametersCoin(BaseModel): + """ + Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`. + """ # noqa: E501 + exchange_ratio: Optional[StrictStr] = Field(default=None, description="The cash equivalent of the points defined in the `points_ratio` property.") + points_ratio: Optional[StrictStr] = Field(default=None, description="The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property.") + __properties: ClassVar[List[str]] = ["exchange_ratio", "points_ratio"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParametersCoin 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, + ) + # set to None if exchange_ratio (nullable) is None + # and model_fields_set contains the field + if self.exchange_ratio is None and "exchange_ratio" in self.model_fields_set: + _dict['exchange_ratio'] = None + + # set to None if points_ratio (nullable) is None + # and model_fields_set contains the field + if self.points_ratio is None and "points_ratio" in self.model_fields_set: + _dict['points_ratio'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParametersCoin from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "exchange_ratio": obj.get("exchange_ratio"), + "points_ratio": obj.get("points_ratio") + }) + return _obj + + diff --git a/voucherify/models/rewards_update_request_body_parameters_product.py b/voucherify/models/rewards_update_request_body_parameters_product.py new file mode 100644 index 00000000..101efca2 --- /dev/null +++ b/voucherify/models/rewards_update_request_body_parameters_product.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateRequestBodyParametersProduct(BaseModel): + """ + Define the product given as a reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID, assigned by Voucherify, given as a reward.") + sku_id: Optional[StrictStr] = Field(default=None, description="Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.") + __properties: ClassVar[List[str]] = ["id", "sku_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParametersProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if sku_id (nullable) is None + # and model_fields_set contains the field + if self.sku_id is None and "sku_id" in self.model_fields_set: + _dict['sku_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateRequestBodyParametersProduct 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"), + "sku_id": obj.get("sku_id") + }) + return _obj + + diff --git a/voucherify/models/rewards_update_response_body.py b/voucherify/models/rewards_update_response_body.py new file mode 100644 index 00000000..caf78923 --- /dev/null +++ b/voucherify/models/rewards_update_response_body.py @@ -0,0 +1,179 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.reward_type import RewardType +from voucherify.models.rewards_update_response_body_attributes import RewardsUpdateResponseBodyAttributes +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/rewards/{rewardId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID, assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + stock: Optional[StrictInt] = Field(default=None, description="Configurable for **material rewards**. The number of units of the product that you want to share as reward.") + redeemed: Optional[StrictInt] = Field(default=None, description="Defines the number of already invoked (successful) reward redemptions. ") + attributes: Optional[RewardsUpdateResponseBodyAttributes] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format.") + type: Optional[StrictStr] = Field(default=None, description="Reward type.") + parameters: Optional[RewardType] = None + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the reward was updated. The value is shown in the ISO 8601 format.") + object: StrictStr = Field(description="The type of the object represented by the JSON. This object stores information about the reward.") + __properties: ClassVar[List[str]] = ["id", "name", "stock", "redeemed", "attributes", "metadata", "type", "parameters", "created_at", "updated_at", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CAMPAIGN', 'COIN', 'MATERIAL']): + raise ValueError("must be one of enum values ('CAMPAIGN', 'COIN', 'MATERIAL')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['reward']): + raise ValueError("must be one of enum values ('reward')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateResponseBody 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 attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if stock (nullable) is None + # and model_fields_set contains the field + if self.stock is None and "stock" in self.model_fields_set: + _dict['stock'] = None + + # set to None if redeemed (nullable) is None + # and model_fields_set contains the field + if self.redeemed is None and "redeemed" in self.model_fields_set: + _dict['redeemed'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateResponseBody 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"), + "name": obj.get("name"), + "stock": obj.get("stock"), + "redeemed": obj.get("redeemed"), + "attributes": RewardsUpdateResponseBodyAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None, + "metadata": obj.get("metadata"), + "type": obj.get("type"), + "parameters": RewardType.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'reward' + }) + return _obj + + diff --git a/voucherify/models/rewards_update_response_body_attributes.py b/voucherify/models/rewards_update_response_body_attributes.py new file mode 100644 index 00000000..47b0fd80 --- /dev/null +++ b/voucherify/models/rewards_update_response_body_attributes.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RewardsUpdateResponseBodyAttributes(BaseModel): + """ + These properties are configurable for **material rewards**. + """ # noqa: E501 + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file.") + description: Optional[StrictStr] = Field(default=None, description="An arbitrary string that you can attach to a material reward.") + __properties: ClassVar[List[str]] = ["image_url", "description"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RewardsUpdateResponseBodyAttributes 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, + ) + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if description (nullable) is None + # and model_fields_set contains the field + if self.description is None and "description" in self.model_fields_set: + _dict['description'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RewardsUpdateResponseBodyAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "image_url": obj.get("image_url"), + "description": obj.get("description") + }) + return _obj + + diff --git a/voucherify/models/segments_create_request_body.py b/voucherify/models/segments_create_request_body.py new file mode 100644 index 00000000..0b3b5ff2 --- /dev/null +++ b/voucherify/models/segments_create_request_body.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class SegmentsCreateRequestBody(BaseModel): + """ + SegmentsCreateRequestBody + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Segment name.") + type: Optional[StrictStr] = None + customers: Optional[List[StrictStr]] = Field(default=None, description="Array of customer IDs.") + filter: Optional[Dict[str, Any]] = Field(default=None, description="Defines a set of criteria for an `auto-update` segment type.") + __properties: ClassVar[List[str]] = ["name", "type", "customers", "filter"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['static', 'auto-update']): + raise ValueError("must be one of enum values ('static', 'auto-update')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SegmentsCreateRequestBody 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, + ) + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if customers (nullable) is None + # and model_fields_set contains the field + if self.customers is None and "customers" in self.model_fields_set: + _dict['customers'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SegmentsCreateRequestBody 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"), + "type": obj.get("type"), + "customers": obj.get("customers"), + "filter": obj.get("filter") + }) + return _obj + + diff --git a/voucherify/models/segments_create_response_body.py b/voucherify/models/segments_create_response_body.py new file mode 100644 index 00000000..b129bcd9 --- /dev/null +++ b/voucherify/models/segments_create_response_body.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SegmentsCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/segments`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique segment ID.") + name: Optional[StrictStr] = Field(default=None, description="Segment name.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format.") + type: Optional[StrictStr] = Field(default=None, description="Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).") + filter: Optional[Dict[str, Any]] = Field(default=None, description="Defines a set of criteria for an `auto-update` segment type. ") + initial_sync_status: Optional[StrictStr] = None + object: Optional[StrictStr] = Field(default='segment', description="The type of the object represented by JSON. This object stores information about the customer segment.") + __properties: ClassVar[List[str]] = ["id", "name", "created_at", "type", "filter", "initial_sync_status", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto-update', 'static']): + raise ValueError("must be one of enum values ('auto-update', 'static')") + return value + + @field_validator('initial_sync_status') + def initial_sync_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['IN_PROGRESS', 'DONE']): + raise ValueError("must be one of enum values ('IN_PROGRESS', 'DONE')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['segment']): + raise ValueError("must be one of enum values ('segment')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SegmentsCreateResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + # set to None if initial_sync_status (nullable) is None + # and model_fields_set contains the field + if self.initial_sync_status is None and "initial_sync_status" in self.model_fields_set: + _dict['initial_sync_status'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SegmentsCreateResponseBody 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"), + "name": obj.get("name"), + "created_at": obj.get("created_at"), + "type": obj.get("type"), + "filter": obj.get("filter"), + "initial_sync_status": obj.get("initial_sync_status"), + "object": obj.get("object") if obj.get("object") is not None else 'segment' + }) + return _obj + + diff --git a/voucherify/models/segments_get_response_body.py b/voucherify/models/segments_get_response_body.py new file mode 100644 index 00000000..73de216a --- /dev/null +++ b/voucherify/models/segments_get_response_body.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SegmentsGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/v1/segments/{segmentId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique segment ID.") + name: Optional[StrictStr] = Field(default=None, description="Segment name.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format.") + type: Optional[StrictStr] = Field(default=None, description="Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).") + filter: Optional[Dict[str, Any]] = Field(default=None, description="Defines a set of criteria for an `auto-update` segment type. ") + initial_sync_status: Optional[StrictStr] = None + object: Optional[StrictStr] = Field(default='segment', description="The type of the object represented by JSON. This object stores information about the customer segment.") + __properties: ClassVar[List[str]] = ["id", "name", "created_at", "type", "filter", "initial_sync_status", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['auto-update', 'static']): + raise ValueError("must be one of enum values ('auto-update', 'static')") + return value + + @field_validator('initial_sync_status') + def initial_sync_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['IN_PROGRESS', 'DONE']): + raise ValueError("must be one of enum values ('IN_PROGRESS', 'DONE')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['segment']): + raise ValueError("must be one of enum values ('segment')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SegmentsGetResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if filter (nullable) is None + # and model_fields_set contains the field + if self.filter is None and "filter" in self.model_fields_set: + _dict['filter'] = None + + # set to None if initial_sync_status (nullable) is None + # and model_fields_set contains the field + if self.initial_sync_status is None and "initial_sync_status" in self.model_fields_set: + _dict['initial_sync_status'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SegmentsGetResponseBody 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"), + "name": obj.get("name"), + "created_at": obj.get("created_at"), + "type": obj.get("type"), + "filter": obj.get("filter"), + "initial_sync_status": obj.get("initial_sync_status"), + "object": obj.get("object") if obj.get("object") is not None else 'segment' + }) + return _obj + + diff --git a/voucherify/models/session.py b/voucherify/models/session.py new file mode 100644 index 00000000..48496a8a --- /dev/null +++ b/voucherify/models/session.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class Session(BaseModel): + """ + Session + """ # noqa: E501 + key: Optional[StrictStr] = Field(default=None, description="The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.") + type: Optional[StrictStr] = Field(default='LOCK', description="This parameter is required to establish a new session.") + ttl: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter.") + ttl_unit: Optional[StrictStr] = Field(default=None, description="Defines the type of unit in which the session time is counted.") + __properties: ClassVar[List[str]] = ["key", "type", "ttl", "ttl_unit"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOCK']): + raise ValueError("must be one of enum values ('LOCK')") + return value + + @field_validator('ttl_unit') + def ttl_unit_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DAYS', 'HOURS', 'MICROSECONDS', 'MILLISECONDS', 'MINUTES', 'NANOSECONDS', 'SECONDS']): + raise ValueError("must be one of enum values ('DAYS', 'HOURS', 'MICROSECONDS', 'MILLISECONDS', 'MINUTES', 'NANOSECONDS', 'SECONDS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Session 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, + ) + # set to None if key (nullable) is None + # and model_fields_set contains the field + if self.key is None and "key" in self.model_fields_set: + _dict['key'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if ttl (nullable) is None + # and model_fields_set contains the field + if self.ttl is None and "ttl" in self.model_fields_set: + _dict['ttl'] = None + + # set to None if ttl_unit (nullable) is None + # and model_fields_set contains the field + if self.ttl_unit is None and "ttl_unit" in self.model_fields_set: + _dict['ttl_unit'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Session from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "type": obj.get("type") if obj.get("type") is not None else 'LOCK', + "ttl": obj.get("ttl"), + "ttl_unit": obj.get("ttl_unit") + }) + return _obj + + diff --git a/voucherify/models/simple_customer.py b/voucherify/models/simple_customer.py new file mode 100644 index 00000000..495c4498 --- /dev/null +++ b/voucherify/models/simple_customer.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class SimpleCustomer(BaseModel): + """ + Simplified customer data. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of an existing customer. It is assigned by Voucherify.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique identifier of the customer. It can be a customer ID or email from a CRM system, database, or a third-party service.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that are attached to the customer. It stores all custom attributes assigned to the customer.") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "name", "email", "source_id", "metadata", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer']): + raise ValueError("must be one of enum values ('customer')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleCustomer 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleCustomer 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"), + "name": obj.get("name"), + "email": obj.get("email"), + "source_id": obj.get("source_id"), + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/simple_customer_required_object_type.py b/voucherify/models/simple_customer_required_object_type.py new file mode 100644 index 00000000..6a53af6b --- /dev/null +++ b/voucherify/models/simple_customer_required_object_type.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SimpleCustomerRequiredObjectType(BaseModel): + """ + This is an object representing a customer with limited properties used in Event Tracking endpoints. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The unique ID of a customer that is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service.") + name: Optional[StrictStr] = Field(default=None, description="Customer's first and last name.") + email: Optional[StrictStr] = Field(default=None, description="Customer's email address.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. ") + object: Optional[StrictStr] = Field(default='customer', description="The type of the object represented by the JSON. This object stores information about the customer.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name", "email", "metadata", "object"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleCustomerRequiredObjectType 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if email (nullable) is None + # and model_fields_set contains the field + if self.email is None and "email" in self.model_fields_set: + _dict['email'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleCustomerRequiredObjectType 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name"), + "email": obj.get("email"), + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'customer' + }) + return _obj + + diff --git a/voucherify/models/simple_loyalty_card.py b/voucherify/models/simple_loyalty_card.py new file mode 100644 index 00000000..b1e99fee --- /dev/null +++ b/voucherify/models/simple_loyalty_card.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SimpleLoyaltyCard(BaseModel): + """ + Simplified loyalty card data. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[StrictStr] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/simple_product_discount_unit.py b/voucherify/models/simple_product_discount_unit.py new file mode 100644 index 00000000..591d30fe --- /dev/null +++ b/voucherify/models/simple_product_discount_unit.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SimpleProductDiscountUnit(BaseModel): + """ + SimpleProductDiscountUnit + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID, assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Product's source ID.") + name: Optional[StrictStr] = Field(default=None, description="Product name.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleProductDiscountUnit 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleProductDiscountUnit 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/simple_segment.py b/voucherify/models/simple_segment.py new file mode 100644 index 00000000..8eb97389 --- /dev/null +++ b/voucherify/models/simple_segment.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class SimpleSegment(BaseModel): + """ + SimpleSegment + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique segment ID.") + name: Optional[StrictStr] = Field(default=None, description="Segment name.") + object: Optional[StrictStr] = Field(default='segment', description="The type of the object represented by the ID.") + __properties: ClassVar[List[str]] = ["id", "name", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['segment']): + raise ValueError("must be one of enum values ('segment')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleSegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleSegment 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"), + "name": obj.get("name"), + "object": obj.get("object") if obj.get("object") is not None else 'segment' + }) + return _obj + + diff --git a/voucherify/models/simple_sku_discount_unit.py b/voucherify/models/simple_sku_discount_unit.py new file mode 100644 index 00000000..95543242 --- /dev/null +++ b/voucherify/models/simple_sku_discount_unit.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SimpleSkuDiscountUnit(BaseModel): + """ + SimpleSkuDiscountUnit + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique SKU ID, assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Product variant's source ID.") + name: Optional[StrictStr] = Field(default=None, description="Sku name") + __properties: ClassVar[List[str]] = ["id", "source_id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleSkuDiscountUnit 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleSkuDiscountUnit 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/simple_voucher.py b/voucherify/models/simple_voucher.py new file mode 100644 index 00000000..a1753399 --- /dev/null +++ b/voucherify/models/simple_voucher.py @@ -0,0 +1,263 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from voucherify.models.simple_loyalty_card import SimpleLoyaltyCard +from voucherify.models.simple_voucher_redemption import SimpleVoucherRedemption +from typing import Optional, Set +from typing_extensions import Self + +class SimpleVoucher(BaseModel): + """ + Simplified voucher data. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the voucher assigned by Voucherify.") + code: Optional[StrictStr] = Field(default=None, description="Voucher code.") + gift: Optional[Gift] = None + discount: Optional[Discount] = None + loyalty_card: Optional[SimpleLoyaltyCard] = None + type: Optional[StrictStr] = Field(default=None, description="Type of the voucher.") + campaign: Optional[StrictStr] = Field(default=None, description="Campaign name.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Campaign unique ID.") + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referrer assigned by Voucherify.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the category that this voucher belongs to.") + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + active: Optional[StrictBool] = Field(default=None, description="Shows whether the voucher is on or off. `true` indicates an *active* voucher and `false` indicates an *inactive* voucher.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.") + redemption: Optional[SimpleVoucherRedemption] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date.") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of custom key/value pairs that you can attach to a voucher. The metadata object stores all custom attributes assigned to the voucher.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON.") + __properties: ClassVar[List[str]] = ["id", "code", "gift", "discount", "loyalty_card", "type", "campaign", "campaign_id", "is_referral_code", "holder_id", "referrer_id", "category_id", "categories", "active", "created_at", "updated_at", "redemption", "start_date", "expiration_date", "metadata", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['DISCOUNT_VOUCHER', 'LOYALTY_CARD', 'GIFT_VOUCHER']): + raise ValueError("must be one of enum values ('DISCOUNT_VOUCHER', 'LOYALTY_CARD', 'GIFT_VOUCHER')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleVoucher 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 gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleVoucher 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"), + "code": obj.get("code"), + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "loyalty_card": SimpleLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "type": obj.get("type"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "is_referral_code": obj.get("is_referral_code"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "category_id": obj.get("category_id"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "active": obj.get("active"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "redemption": SimpleVoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "metadata": obj.get("metadata"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher' + }) + return _obj + + diff --git a/voucherify/models/simple_voucher_redemption.py b/voucherify/models/simple_voucher_redemption.py new file mode 100644 index 00000000..52a9d5bb --- /dev/null +++ b/voucherify/models/simple_voucher_redemption.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SimpleVoucherRedemption(BaseModel): + """ + Defines the redemption limits on vouchers. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleVoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleVoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity") + }) + return _obj + + diff --git a/voucherify/models/sku.py b/voucherify/models/sku.py new file mode 100644 index 00000000..8c001499 --- /dev/null +++ b/voucherify/models/sku.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class Sku(BaseModel): + """ + This is an object representing a product SKU. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the SKU and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique SKU identifier from your inventory system.") + product_id: Optional[StrictStr] = Field(default=None, description="The parent product's unique ID.") + sku: Optional[StrictStr] = Field(default=None, description="Unique user-defined SKU name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + currency: Optional[StrictStr] = Field(default=None, description="SKU price currency.") + attributes: Optional[Dict[str, Any]] = Field(default=None, description="The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='sku', description="The type of the object represented by JSON. This object stores information about the `SKU`.") + __properties: ClassVar[List[str]] = ["id", "source_id", "product_id", "sku", "price", "currency", "attributes", "image_url", "metadata", "created_at", "updated_at", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['sku']): + raise ValueError("must be one of enum values ('sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Sku 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Sku 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"), + "source_id": obj.get("source_id"), + "product_id": obj.get("product_id"), + "sku": obj.get("sku"), + "price": obj.get("price"), + "currency": obj.get("currency"), + "attributes": obj.get("attributes"), + "image_url": obj.get("image_url"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'sku' + }) + return _obj + + diff --git a/voucherify/models/skus_get_response_body.py b/voucherify/models/skus_get_response_body.py new file mode 100644 index 00000000..f5a92f74 --- /dev/null +++ b/voucherify/models/skus_get_response_body.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class SkusGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/skus/{skuId}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique identifier that represents the SKU and is assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="A unique SKU identifier from your inventory system.") + product_id: Optional[StrictStr] = Field(default=None, description="The parent product's unique ID.") + sku: Optional[StrictStr] = Field(default=None, description="Unique user-defined SKU name.") + price: Optional[StrictInt] = Field(default=None, description="Unit price. It is represented by a value multiplied by 100 to accurately reflect 2 decimal places, such as `$100.00` being expressed as `10000`.") + currency: Optional[StrictStr] = Field(default=None, description="SKU price currency.") + attributes: Optional[Dict[str, Any]] = Field(default=None, description="The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family.") + image_url: Optional[StrictStr] = Field(default=None, description="The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the SKU was updated. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='sku', description="The type of the object represented by JSON. This object stores information about the `SKU`.") + __properties: ClassVar[List[str]] = ["id", "source_id", "product_id", "sku", "price", "currency", "attributes", "image_url", "metadata", "created_at", "updated_at", "object"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['sku']): + raise ValueError("must be one of enum values ('sku')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SkusGetResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if product_id (nullable) is None + # and model_fields_set contains the field + if self.product_id is None and "product_id" in self.model_fields_set: + _dict['product_id'] = None + + # set to None if sku (nullable) is None + # and model_fields_set contains the field + if self.sku is None and "sku" in self.model_fields_set: + _dict['sku'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + # set to None if attributes (nullable) is None + # and model_fields_set contains the field + if self.attributes is None and "attributes" in self.model_fields_set: + _dict['attributes'] = None + + # set to None if image_url (nullable) is None + # and model_fields_set contains the field + if self.image_url is None and "image_url" in self.model_fields_set: + _dict['image_url'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SkusGetResponseBody 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"), + "source_id": obj.get("source_id"), + "product_id": obj.get("product_id"), + "sku": obj.get("sku"), + "price": obj.get("price"), + "currency": obj.get("currency"), + "attributes": obj.get("attributes"), + "image_url": obj.get("image_url"), + "metadata": obj.get("metadata"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "object": obj.get("object") if obj.get("object") is not None else 'sku' + }) + return _obj + + diff --git a/voucherify/models/skus_import_csv_create_response_body.py b/voucherify/models/skus_import_csv_create_response_body.py new file mode 100644 index 00000000..466f2651 --- /dev/null +++ b/voucherify/models/skus_import_csv_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SkusImportCsvCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/skus/importCSV`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SkusImportCsvCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SkusImportCsvCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/skus_list_for_product.py b/voucherify/models/skus_list_for_product.py new file mode 100644 index 00000000..dae6a3f1 --- /dev/null +++ b/voucherify/models/skus_list_for_product.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.sku import Sku +from typing import Optional, Set +from typing_extensions import Self + +class SkusListForProduct(BaseModel): + """ + Contains information about child SKUs. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about SKUs.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of SKUs.") + data: Optional[List[Sku]] = Field(default=None, description="A dictionary that contains an array of SKUs.") + total: Optional[StrictInt] = Field(default=None, description="Total number of SKUs in the product.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SkusListForProduct 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SkusListForProduct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [Sku.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/stacking_rules.py b/voucherify/models/stacking_rules.py new file mode 100644 index 00000000..002997c8 --- /dev/null +++ b/voucherify/models/stacking_rules.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class StackingRules(BaseModel): + """ + Defines stacking rules for redeemables. Read more in the [Help Center](https://support.voucherify.io/article/604-stacking-rules) + """ # noqa: E501 + redeemables_limit: Optional[Annotated[int, Field(le=30, strict=True, ge=1)]] = Field(default=30, description="Defines how many redeemables can be sent in one stacking request (note: more redeemables means more processing time!).") + applicable_redeemables_limit: Optional[Annotated[int, Field(le=30, strict=True, ge=1)]] = Field(default=5, description="Defines how many of the sent redeemables will be applied to the order. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be labelled as SKIPPED.") + applicable_redeemables_per_category_limit: Optional[Annotated[int, Field(le=5, strict=True, ge=1)]] = Field(default=1, description="Defines how many redeemables per category can be applied in one request.") + applicable_exclusive_redeemables_limit: Optional[Annotated[int, Field(le=5, strict=True, ge=1)]] = Field(default=1, description="Defines how many redeemables with an exclusive category can be applied in one request.") + applicable_exclusive_redeemables_per_category_limit: Optional[Annotated[int, Field(le=5, strict=True, ge=1)]] = Field(default=1, description="Defines how many redeemables with an exclusive category per category in stacking rules can be applied in one request.") + exclusive_categories: Optional[List[StrictStr]] = Field(default=None, description="Lists all exclusive categories. A redeemable from a campaign with an exclusive category is the only redeemable to be redeemed when applied with redeemables from other campaigns unless these campaigns are exclusive or joint.") + joint_categories: Optional[List[StrictStr]] = Field(default=None, description="Lists all joint categories. A campaign with a joint category is always applied regardless of the exclusivity of other campaigns.") + redeemables_application_mode: Optional[StrictStr] = Field(default=None, description="Defines redeemables application mode.") + redeemables_sorting_rule: Optional[StrictStr] = Field(default='REQUESTED_ORDER', description="Defines redeemables sorting rule.") + redeemables_products_application_mode: Optional[StrictStr] = Field(default=None, description="Defines redeemables products application mode.") + redeemables_no_effect_rule: Optional[StrictStr] = Field(default=None, description="Defines redeemables no effect rule.") + __properties: ClassVar[List[str]] = ["redeemables_limit", "applicable_redeemables_limit", "applicable_redeemables_per_category_limit", "applicable_exclusive_redeemables_limit", "applicable_exclusive_redeemables_per_category_limit", "exclusive_categories", "joint_categories", "redeemables_application_mode", "redeemables_sorting_rule", "redeemables_products_application_mode", "redeemables_no_effect_rule"] + + @field_validator('redeemables_application_mode') + def redeemables_application_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ALL', 'PARTIAL']): + raise ValueError("must be one of enum values ('ALL', 'PARTIAL')") + return value + + @field_validator('redeemables_sorting_rule') + def redeemables_sorting_rule_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['CATEGORY_HIERARCHY', 'REQUESTED_ORDER']): + raise ValueError("must be one of enum values ('CATEGORY_HIERARCHY', 'REQUESTED_ORDER')") + return value + + @field_validator('redeemables_products_application_mode') + def redeemables_products_application_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['STACK', 'ONCE']): + raise ValueError("must be one of enum values ('STACK', 'ONCE')") + return value + + @field_validator('redeemables_no_effect_rule') + def redeemables_no_effect_rule_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['REDEEM_ANYWAY', 'SKIP']): + raise ValueError("must be one of enum values ('REDEEM_ANYWAY', 'SKIP')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StackingRules 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, + ) + # set to None if redeemables_limit (nullable) is None + # and model_fields_set contains the field + if self.redeemables_limit is None and "redeemables_limit" in self.model_fields_set: + _dict['redeemables_limit'] = None + + # set to None if applicable_redeemables_limit (nullable) is None + # and model_fields_set contains the field + if self.applicable_redeemables_limit is None and "applicable_redeemables_limit" in self.model_fields_set: + _dict['applicable_redeemables_limit'] = None + + # set to None if applicable_redeemables_per_category_limit (nullable) is None + # and model_fields_set contains the field + if self.applicable_redeemables_per_category_limit is None and "applicable_redeemables_per_category_limit" in self.model_fields_set: + _dict['applicable_redeemables_per_category_limit'] = None + + # set to None if applicable_exclusive_redeemables_limit (nullable) is None + # and model_fields_set contains the field + if self.applicable_exclusive_redeemables_limit is None and "applicable_exclusive_redeemables_limit" in self.model_fields_set: + _dict['applicable_exclusive_redeemables_limit'] = None + + # set to None if applicable_exclusive_redeemables_per_category_limit (nullable) is None + # and model_fields_set contains the field + if self.applicable_exclusive_redeemables_per_category_limit is None and "applicable_exclusive_redeemables_per_category_limit" in self.model_fields_set: + _dict['applicable_exclusive_redeemables_per_category_limit'] = None + + # set to None if exclusive_categories (nullable) is None + # and model_fields_set contains the field + if self.exclusive_categories is None and "exclusive_categories" in self.model_fields_set: + _dict['exclusive_categories'] = None + + # set to None if joint_categories (nullable) is None + # and model_fields_set contains the field + if self.joint_categories is None and "joint_categories" in self.model_fields_set: + _dict['joint_categories'] = None + + # set to None if redeemables_application_mode (nullable) is None + # and model_fields_set contains the field + if self.redeemables_application_mode is None and "redeemables_application_mode" in self.model_fields_set: + _dict['redeemables_application_mode'] = None + + # set to None if redeemables_sorting_rule (nullable) is None + # and model_fields_set contains the field + if self.redeemables_sorting_rule is None and "redeemables_sorting_rule" in self.model_fields_set: + _dict['redeemables_sorting_rule'] = None + + # set to None if redeemables_products_application_mode (nullable) is None + # and model_fields_set contains the field + if self.redeemables_products_application_mode is None and "redeemables_products_application_mode" in self.model_fields_set: + _dict['redeemables_products_application_mode'] = None + + # set to None if redeemables_no_effect_rule (nullable) is None + # and model_fields_set contains the field + if self.redeemables_no_effect_rule is None and "redeemables_no_effect_rule" in self.model_fields_set: + _dict['redeemables_no_effect_rule'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StackingRules from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "redeemables_limit": obj.get("redeemables_limit") if obj.get("redeemables_limit") is not None else 30, + "applicable_redeemables_limit": obj.get("applicable_redeemables_limit") if obj.get("applicable_redeemables_limit") is not None else 5, + "applicable_redeemables_per_category_limit": obj.get("applicable_redeemables_per_category_limit") if obj.get("applicable_redeemables_per_category_limit") is not None else 1, + "applicable_exclusive_redeemables_limit": obj.get("applicable_exclusive_redeemables_limit") if obj.get("applicable_exclusive_redeemables_limit") is not None else 1, + "applicable_exclusive_redeemables_per_category_limit": obj.get("applicable_exclusive_redeemables_per_category_limit") if obj.get("applicable_exclusive_redeemables_per_category_limit") is not None else 1, + "exclusive_categories": obj.get("exclusive_categories"), + "joint_categories": obj.get("joint_categories"), + "redeemables_application_mode": obj.get("redeemables_application_mode"), + "redeemables_sorting_rule": obj.get("redeemables_sorting_rule") if obj.get("redeemables_sorting_rule") is not None else 'REQUESTED_ORDER', + "redeemables_products_application_mode": obj.get("redeemables_products_application_mode"), + "redeemables_no_effect_rule": obj.get("redeemables_no_effect_rule") + }) + return _obj + + diff --git a/voucherify/models/validation_rule.py b/voucherify/models/validation_rule.py new file mode 100644 index 00000000..c667c7dc --- /dev/null +++ b/voucherify/models/validation_rule.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.validation_rule_applicable_to import ValidationRuleApplicableTo +from voucherify.models.validation_rule_error import ValidationRuleError +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRule(BaseModel): + """ + ValidationRule + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Custom, unique name for set of validation rules.") + rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions.") + error: Optional[ValidationRuleError] = None + applicable_to: Optional[ValidationRuleApplicableTo] = None + type: Optional[StrictStr] = Field(default='expression', description="Type of validation rule.") + context_type: Optional[StrictStr] = Field(default='global', description="Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | |") + id: Optional[StrictStr] = Field(default=None, description="Unique validation rule ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format.") + assignments_count: Optional[StrictInt] = Field(default=None, description="The number of instances the validation rule has been assigned to different types of redeemables.") + object: Optional[StrictStr] = Field(default='validation_rules', description="The type of the object represented by JSON. This object stores information about the validation rule.") + __properties: ClassVar[List[str]] = ["name", "rules", "error", "applicable_to", "type", "context_type", "id", "created_at", "updated_at", "assignments_count", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expression', 'basic', 'advanced', 'complex']): + raise ValueError("must be one of enum values ('expression', 'basic', 'advanced', 'complex')") + return value + + @field_validator('context_type') + def context_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global']): + raise ValueError("must be one of enum values ('earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRule 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 error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + # set to None if applicable_to (nullable) is None + # and model_fields_set contains the field + if self.applicable_to is None and "applicable_to" in self.model_fields_set: + _dict['applicable_to'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if context_type (nullable) is None + # and model_fields_set contains the field + if self.context_type is None and "context_type" in self.model_fields_set: + _dict['context_type'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assignments_count (nullable) is None + # and model_fields_set contains the field + if self.assignments_count is None and "assignments_count" in self.model_fields_set: + _dict['assignments_count'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRule 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"), + "rules": obj.get("rules"), + "error": ValidationRuleError.from_dict(obj["error"]) if obj.get("error") is not None else None, + "applicable_to": ValidationRuleApplicableTo.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "type": obj.get("type") if obj.get("type") is not None else 'expression', + "context_type": obj.get("context_type") if obj.get("context_type") is not None else 'global', + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assignments_count": obj.get("assignments_count"), + "object": obj.get("object") if obj.get("object") is not None else 'validation_rules' + }) + return _obj + + diff --git a/voucherify/models/validation_rule_applicable_to.py b/voucherify/models/validation_rule_applicable_to.py new file mode 100644 index 00000000..7c581632 --- /dev/null +++ b/voucherify/models/validation_rule_applicable_to.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to import ApplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRuleApplicableTo(BaseModel): + """ + ValidationRuleApplicableTo + """ # noqa: E501 + excluded: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are excluded from a discount.") + included: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are included in a discount.") + included_all: Optional[StrictBool] = Field(default=None, description="Indicates whether all items are included in the discount.") + __properties: ClassVar[List[str]] = ["excluded", "included", "included_all"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRuleApplicableTo 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 excluded (list) + _items = [] + if self.excluded: + for _item_excluded in self.excluded: + if _item_excluded: + _items.append(_item_excluded.to_dict()) + _dict['excluded'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in included (list) + _items = [] + if self.included: + for _item_included in self.included: + if _item_included: + _items.append(_item_included.to_dict()) + _dict['included'] = _items + # set to None if excluded (nullable) is None + # and model_fields_set contains the field + if self.excluded is None and "excluded" in self.model_fields_set: + _dict['excluded'] = None + + # set to None if included (nullable) is None + # and model_fields_set contains the field + if self.included is None and "included" in self.model_fields_set: + _dict['included'] = None + + # set to None if included_all (nullable) is None + # and model_fields_set contains the field + if self.included_all is None and "included_all" in self.model_fields_set: + _dict['included_all'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRuleApplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "excluded": [ApplicableTo.from_dict(_item) for _item in obj["excluded"]] if obj.get("excluded") is not None else None, + "included": [ApplicableTo.from_dict(_item) for _item in obj["included"]] if obj.get("included") is not None else None, + "included_all": obj.get("included_all") + }) + return _obj + + diff --git a/voucherify/models/validation_rule_assignment.py b/voucherify/models/validation_rule_assignment.py new file mode 100644 index 00000000..ec8890af --- /dev/null +++ b/voucherify/models/validation_rule_assignment.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRuleAssignment(BaseModel): + """ + This is an object representing a validation rule assignment. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Validation rule assignment ID.") + rule_id: Optional[StrictStr] = Field(default=None, description="Validation rule ID.") + related_object_id: Optional[StrictStr] = Field(default=None, description="The resource ID to which the validation rule was assigned.") + related_object_type: Optional[StrictStr] = Field(default=None, description="The type of resource to which the validation rule was assigned.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='validation_rules_assignment', description="The type of the object represented by the ID.") + __properties: ClassVar[List[str]] = ["id", "rule_id", "related_object_id", "related_object_type", "created_at", "object"] + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'campaign', 'earning_rule', 'reward_assignment', 'promotion_tier', 'distribution']): + raise ValueError("must be one of enum values ('voucher', 'campaign', 'earning_rule', 'reward_assignment', 'promotion_tier', 'distribution')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['validation_rules_assignment']): + raise ValueError("must be one of enum values ('validation_rules_assignment')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRuleAssignment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if rule_id (nullable) is None + # and model_fields_set contains the field + if self.rule_id is None and "rule_id" in self.model_fields_set: + _dict['rule_id'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRuleAssignment 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"), + "rule_id": obj.get("rule_id"), + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type"), + "created_at": obj.get("created_at"), + "object": obj.get("object") if obj.get("object") is not None else 'validation_rules_assignment' + }) + return _obj + + diff --git a/voucherify/models/validation_rule_assignments_list.py b/voucherify/models/validation_rule_assignments_list.py new file mode 100644 index 00000000..6fda3a27 --- /dev/null +++ b/voucherify/models/validation_rule_assignments_list.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validation_rule_assignment import ValidationRuleAssignment +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRuleAssignmentsList(BaseModel): + """ + Validation Rule Assignments List + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about validation rule assignments.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of validation rule assignments.") + data: Optional[List[ValidationRuleAssignment]] = Field(default=None, description="A dictionary that contains an array of validation rule assignments.") + total: Optional[StrictInt] = Field(default=None, description="Total number of validation rule assignments.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRuleAssignmentsList 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRuleAssignmentsList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [ValidationRuleAssignment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/validation_rule_error.py b/voucherify/models/validation_rule_error.py new file mode 100644 index 00000000..42100ee6 --- /dev/null +++ b/voucherify/models/validation_rule_error.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRuleError(BaseModel): + """ + Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, description="The error message returned from API when validation / redemption fails to meet requirements of defined rules.") + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRuleError 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, + ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRuleError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_assignments_create_request_body.py b/voucherify/models/validation_rules_assignments_create_request_body.py new file mode 100644 index 00000000..e0187fc5 --- /dev/null +++ b/voucherify/models/validation_rules_assignments_create_request_body.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ValidationRulesAssignmentsCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/validation-rules/{validationRuleId}/assignments`. + """ # noqa: E501 + related_object_type: Optional[StrictStr] = Field(default='voucher', description="Defines the related object, e.g. `voucher`.") + related_object_id: Optional[StrictStr] = Field(default=None, description="Unique related object ID assigned by Voucherify, e.g. `v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno` for a voucher.") + __properties: ClassVar[List[str]] = ["related_object_type", "related_object_id"] + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'campaign', 'earning_rule', 'distribution', 'reward_assignment']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'campaign', 'earning_rule', 'distribution', 'reward_assignment')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsCreateRequestBody 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, + ) + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "related_object_type": obj.get("related_object_type") if obj.get("related_object_type") is not None else 'voucher', + "related_object_id": obj.get("related_object_id") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_assignments_create_response_body.py b/voucherify/models/validation_rules_assignments_create_response_body.py new file mode 100644 index 00000000..50ff1048 --- /dev/null +++ b/voucherify/models/validation_rules_assignments_create_response_body.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesAssignmentsCreateResponseBody(BaseModel): + """ + Response body for **POST** `v1/validation-rules/{validationRuleId}/assignments`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Validation rule assignment ID.") + rule_id: Optional[StrictStr] = Field(default=None, description="Validation rule ID.") + related_object_id: Optional[StrictStr] = Field(default=None, description="The resource ID to which the validation rule was assigned.") + related_object_type: Optional[StrictStr] = Field(default=None, description="The type of resource to which the validation rule was assigned.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule assignment was created. The value is shown in the ISO 8601 format.") + object: Optional[StrictStr] = Field(default='validation_rules_assignment', description="The type of the object represented by the ID.") + __properties: ClassVar[List[str]] = ["id", "rule_id", "related_object_id", "related_object_type", "created_at", "object"] + + @field_validator('related_object_type') + def related_object_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'campaign', 'earning_rule', 'reward_assignment', 'promotion_tier', 'distribution']): + raise ValueError("must be one of enum values ('voucher', 'campaign', 'earning_rule', 'reward_assignment', 'promotion_tier', 'distribution')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['validation_rules_assignment']): + raise ValueError("must be one of enum values ('validation_rules_assignment')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsCreateResponseBody 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if rule_id (nullable) is None + # and model_fields_set contains the field + if self.rule_id is None and "rule_id" in self.model_fields_set: + _dict['rule_id'] = None + + # set to None if related_object_id (nullable) is None + # and model_fields_set contains the field + if self.related_object_id is None and "related_object_id" in self.model_fields_set: + _dict['related_object_id'] = None + + # set to None if related_object_type (nullable) is None + # and model_fields_set contains the field + if self.related_object_type is None and "related_object_type" in self.model_fields_set: + _dict['related_object_type'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsCreateResponseBody 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"), + "rule_id": obj.get("rule_id"), + "related_object_id": obj.get("related_object_id"), + "related_object_type": obj.get("related_object_type"), + "created_at": obj.get("created_at"), + "object": obj.get("object") if obj.get("object") is not None else 'validation_rules_assignment' + }) + return _obj + + diff --git a/voucherify/models/validation_rules_assignments_list.py b/voucherify/models/validation_rules_assignments_list.py new file mode 100644 index 00000000..1d211596 --- /dev/null +++ b/voucherify/models/validation_rules_assignments_list.py @@ -0,0 +1,143 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.bus_val_rule_assignment import BusValRuleAssignment +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesAssignmentsList(BaseModel): + """ + List of Validation Rules Assignments + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about validation rules assignments.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of validation rules assignments.") + data: Optional[List[BusValRuleAssignment]] = Field(default=None, description="Contains array of validation rules assignments.") + total: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Total number of validation rules assignments.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsList 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [BusValRuleAssignment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_assignments_list_response_body.py b/voucherify/models/validation_rules_assignments_list_response_body.py new file mode 100644 index 00000000..0057eea9 --- /dev/null +++ b/voucherify/models/validation_rules_assignments_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validation_rule_assignment import ValidationRuleAssignment +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesAssignmentsListResponseBody(BaseModel): + """ + Response body for **GET** `v1/validation-rules-assignments` and **GET** `v1/validation-rules/{validationRuleId}/assignments`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about validation rule assignments.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the JSON property that contains the array of validation rule assignments.") + data: Optional[List[ValidationRuleAssignment]] = Field(default=None, description="A dictionary that contains an array of validation rule assignments.") + total: Optional[StrictInt] = Field(default=None, description="Total number of validation rule assignments.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesAssignmentsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [ValidationRuleAssignment.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_create_request_body.py b/voucherify/models/validation_rules_create_request_body.py new file mode 100644 index 00000000..8a39b33a --- /dev/null +++ b/voucherify/models/validation_rules_create_request_body.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.validation_rules_create_request_body_applicable_to import ValidationRulesCreateRequestBodyApplicableTo +from voucherify.models.validation_rules_create_request_body_error import ValidationRulesCreateRequestBodyError +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/validation-rules`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Custom, unique name for set of validation rules.") + rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions.") + error: Optional[ValidationRulesCreateRequestBodyError] = None + applicable_to: Optional[ValidationRulesCreateRequestBodyApplicableTo] = None + type: Optional[StrictStr] = Field(default='expression', description="Type of validation rule.") + context_type: Optional[StrictStr] = Field(default='global', description="Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | |") + __properties: ClassVar[List[str]] = ["name", "rules", "error", "applicable_to", "type", "context_type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expression', 'basic', 'advanced', 'complex']): + raise ValueError("must be one of enum values ('expression', 'basic', 'advanced', 'complex')") + return value + + @field_validator('context_type') + def context_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global']): + raise ValueError("must be one of enum values ('earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesCreateRequestBody 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 error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + # set to None if applicable_to (nullable) is None + # and model_fields_set contains the field + if self.applicable_to is None and "applicable_to" in self.model_fields_set: + _dict['applicable_to'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if context_type (nullable) is None + # and model_fields_set contains the field + if self.context_type is None and "context_type" in self.model_fields_set: + _dict['context_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesCreateRequestBody 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"), + "rules": obj.get("rules"), + "error": ValidationRulesCreateRequestBodyError.from_dict(obj["error"]) if obj.get("error") is not None else None, + "applicable_to": ValidationRulesCreateRequestBodyApplicableTo.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "type": obj.get("type") if obj.get("type") is not None else 'expression', + "context_type": obj.get("context_type") if obj.get("context_type") is not None else 'global' + }) + return _obj + + diff --git a/voucherify/models/validation_rules_create_request_body_applicable_to.py b/voucherify/models/validation_rules_create_request_body_applicable_to.py new file mode 100644 index 00000000..d6cda6ba --- /dev/null +++ b/voucherify/models/validation_rules_create_request_body_applicable_to.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to import ApplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesCreateRequestBodyApplicableTo(BaseModel): + """ + ValidationRulesCreateRequestBodyApplicableTo + """ # noqa: E501 + excluded: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are excluded from a discount.") + included: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are included in a discount.") + included_all: Optional[StrictBool] = Field(default=None, description="Indicates whether all items are included in the discount.") + __properties: ClassVar[List[str]] = ["excluded", "included", "included_all"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesCreateRequestBodyApplicableTo 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 excluded (list) + _items = [] + if self.excluded: + for _item_excluded in self.excluded: + if _item_excluded: + _items.append(_item_excluded.to_dict()) + _dict['excluded'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in included (list) + _items = [] + if self.included: + for _item_included in self.included: + if _item_included: + _items.append(_item_included.to_dict()) + _dict['included'] = _items + # set to None if excluded (nullable) is None + # and model_fields_set contains the field + if self.excluded is None and "excluded" in self.model_fields_set: + _dict['excluded'] = None + + # set to None if included (nullable) is None + # and model_fields_set contains the field + if self.included is None and "included" in self.model_fields_set: + _dict['included'] = None + + # set to None if included_all (nullable) is None + # and model_fields_set contains the field + if self.included_all is None and "included_all" in self.model_fields_set: + _dict['included_all'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesCreateRequestBodyApplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "excluded": [ApplicableTo.from_dict(_item) for _item in obj["excluded"]] if obj.get("excluded") is not None else None, + "included": [ApplicableTo.from_dict(_item) for _item in obj["included"]] if obj.get("included") is not None else None, + "included_all": obj.get("included_all") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_create_request_body_error.py b/voucherify/models/validation_rules_create_request_body_error.py new file mode 100644 index 00000000..b7bce896 --- /dev/null +++ b/voucherify/models/validation_rules_create_request_body_error.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesCreateRequestBodyError(BaseModel): + """ + Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, description="The error message returned from API when validation / redemption fails to meet requirements of defined rules.") + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesCreateRequestBodyError 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, + ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesCreateRequestBodyError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_create_response_body.py b/voucherify/models/validation_rules_create_response_body.py new file mode 100644 index 00000000..130ff2a8 --- /dev/null +++ b/voucherify/models/validation_rules_create_response_body.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.validation_rules_create_response_body_applicable_to import ValidationRulesCreateResponseBodyApplicableTo +from voucherify.models.validation_rules_create_response_body_error import ValidationRulesCreateResponseBodyError +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/validation-rules`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Custom, unique name for set of validation rules.") + rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions.") + error: Optional[ValidationRulesCreateResponseBodyError] = None + applicable_to: Optional[ValidationRulesCreateResponseBodyApplicableTo] = None + type: Optional[StrictStr] = Field(default='expression', description="Type of validation rule.") + context_type: Optional[StrictStr] = Field(default='global', description="Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | |") + id: Optional[StrictStr] = Field(default=None, description="Unique validation rule ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format.") + assignments_count: Optional[StrictInt] = Field(default=None, description="The number of instances the validation rule has been assigned to different types of redeemables.") + object: Optional[StrictStr] = Field(default='validation_rules', description="The type of the object represented by JSON. This object stores information about the validation rule.") + __properties: ClassVar[List[str]] = ["name", "rules", "error", "applicable_to", "type", "context_type", "id", "created_at", "updated_at", "assignments_count", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expression', 'basic', 'advanced', 'complex']): + raise ValueError("must be one of enum values ('expression', 'basic', 'advanced', 'complex')") + return value + + @field_validator('context_type') + def context_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global']): + raise ValueError("must be one of enum values ('earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesCreateResponseBody 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 error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + # set to None if applicable_to (nullable) is None + # and model_fields_set contains the field + if self.applicable_to is None and "applicable_to" in self.model_fields_set: + _dict['applicable_to'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if context_type (nullable) is None + # and model_fields_set contains the field + if self.context_type is None and "context_type" in self.model_fields_set: + _dict['context_type'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assignments_count (nullable) is None + # and model_fields_set contains the field + if self.assignments_count is None and "assignments_count" in self.model_fields_set: + _dict['assignments_count'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesCreateResponseBody 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"), + "rules": obj.get("rules"), + "error": ValidationRulesCreateResponseBodyError.from_dict(obj["error"]) if obj.get("error") is not None else None, + "applicable_to": ValidationRulesCreateResponseBodyApplicableTo.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "type": obj.get("type") if obj.get("type") is not None else 'expression', + "context_type": obj.get("context_type") if obj.get("context_type") is not None else 'global', + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assignments_count": obj.get("assignments_count"), + "object": obj.get("object") if obj.get("object") is not None else 'validation_rules' + }) + return _obj + + diff --git a/voucherify/models/validation_rules_create_response_body_applicable_to.py b/voucherify/models/validation_rules_create_response_body_applicable_to.py new file mode 100644 index 00000000..4fc480fa --- /dev/null +++ b/voucherify/models/validation_rules_create_response_body_applicable_to.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to import ApplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesCreateResponseBodyApplicableTo(BaseModel): + """ + ValidationRulesCreateResponseBodyApplicableTo + """ # noqa: E501 + excluded: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are excluded from a discount.") + included: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are included in a discount.") + included_all: Optional[StrictBool] = Field(default=None, description="Indicates whether all items are included in the discount.") + __properties: ClassVar[List[str]] = ["excluded", "included", "included_all"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesCreateResponseBodyApplicableTo 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 excluded (list) + _items = [] + if self.excluded: + for _item_excluded in self.excluded: + if _item_excluded: + _items.append(_item_excluded.to_dict()) + _dict['excluded'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in included (list) + _items = [] + if self.included: + for _item_included in self.included: + if _item_included: + _items.append(_item_included.to_dict()) + _dict['included'] = _items + # set to None if excluded (nullable) is None + # and model_fields_set contains the field + if self.excluded is None and "excluded" in self.model_fields_set: + _dict['excluded'] = None + + # set to None if included (nullable) is None + # and model_fields_set contains the field + if self.included is None and "included" in self.model_fields_set: + _dict['included'] = None + + # set to None if included_all (nullable) is None + # and model_fields_set contains the field + if self.included_all is None and "included_all" in self.model_fields_set: + _dict['included_all'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesCreateResponseBodyApplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "excluded": [ApplicableTo.from_dict(_item) for _item in obj["excluded"]] if obj.get("excluded") is not None else None, + "included": [ApplicableTo.from_dict(_item) for _item in obj["included"]] if obj.get("included") is not None else None, + "included_all": obj.get("included_all") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_create_response_body_error.py b/voucherify/models/validation_rules_create_response_body_error.py new file mode 100644 index 00000000..e7efd580 --- /dev/null +++ b/voucherify/models/validation_rules_create_response_body_error.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesCreateResponseBodyError(BaseModel): + """ + Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, description="The error message returned from API when validation / redemption fails to meet requirements of defined rules.") + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesCreateResponseBodyError 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, + ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesCreateResponseBodyError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_get_response_body.py b/voucherify/models/validation_rules_get_response_body.py new file mode 100644 index 00000000..3ad93fc6 --- /dev/null +++ b/voucherify/models/validation_rules_get_response_body.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.validation_rules_get_response_body_applicable_to import ValidationRulesGetResponseBodyApplicableTo +from voucherify.models.validation_rules_get_response_body_error import ValidationRulesGetResponseBodyError +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/validation-rules/{validationRuleId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Custom, unique name for set of validation rules.") + rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions.") + error: Optional[ValidationRulesGetResponseBodyError] = None + applicable_to: Optional[ValidationRulesGetResponseBodyApplicableTo] = None + type: Optional[StrictStr] = Field(default='expression', description="Type of validation rule.") + context_type: Optional[StrictStr] = Field(default='global', description="Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | |") + id: Optional[StrictStr] = Field(default=None, description="Unique validation rule ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format.") + assignments_count: Optional[StrictInt] = Field(default=None, description="The number of instances the validation rule has been assigned to different types of redeemables.") + object: Optional[StrictStr] = Field(default='validation_rules', description="The type of the object represented by JSON. This object stores information about the validation rule.") + __properties: ClassVar[List[str]] = ["name", "rules", "error", "applicable_to", "type", "context_type", "id", "created_at", "updated_at", "assignments_count", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expression', 'basic', 'advanced', 'complex']): + raise ValueError("must be one of enum values ('expression', 'basic', 'advanced', 'complex')") + return value + + @field_validator('context_type') + def context_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global']): + raise ValueError("must be one of enum values ('earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesGetResponseBody 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 error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + # set to None if applicable_to (nullable) is None + # and model_fields_set contains the field + if self.applicable_to is None and "applicable_to" in self.model_fields_set: + _dict['applicable_to'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if context_type (nullable) is None + # and model_fields_set contains the field + if self.context_type is None and "context_type" in self.model_fields_set: + _dict['context_type'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assignments_count (nullable) is None + # and model_fields_set contains the field + if self.assignments_count is None and "assignments_count" in self.model_fields_set: + _dict['assignments_count'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesGetResponseBody 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"), + "rules": obj.get("rules"), + "error": ValidationRulesGetResponseBodyError.from_dict(obj["error"]) if obj.get("error") is not None else None, + "applicable_to": ValidationRulesGetResponseBodyApplicableTo.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "type": obj.get("type") if obj.get("type") is not None else 'expression', + "context_type": obj.get("context_type") if obj.get("context_type") is not None else 'global', + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assignments_count": obj.get("assignments_count"), + "object": obj.get("object") if obj.get("object") is not None else 'validation_rules' + }) + return _obj + + diff --git a/voucherify/models/validation_rules_get_response_body_applicable_to.py b/voucherify/models/validation_rules_get_response_body_applicable_to.py new file mode 100644 index 00000000..9405d9f1 --- /dev/null +++ b/voucherify/models/validation_rules_get_response_body_applicable_to.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to import ApplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesGetResponseBodyApplicableTo(BaseModel): + """ + ValidationRulesGetResponseBodyApplicableTo + """ # noqa: E501 + excluded: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are excluded from a discount.") + included: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are included in a discount.") + included_all: Optional[StrictBool] = Field(default=None, description="Indicates whether all items are included in the discount.") + __properties: ClassVar[List[str]] = ["excluded", "included", "included_all"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesGetResponseBodyApplicableTo 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 excluded (list) + _items = [] + if self.excluded: + for _item_excluded in self.excluded: + if _item_excluded: + _items.append(_item_excluded.to_dict()) + _dict['excluded'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in included (list) + _items = [] + if self.included: + for _item_included in self.included: + if _item_included: + _items.append(_item_included.to_dict()) + _dict['included'] = _items + # set to None if excluded (nullable) is None + # and model_fields_set contains the field + if self.excluded is None and "excluded" in self.model_fields_set: + _dict['excluded'] = None + + # set to None if included (nullable) is None + # and model_fields_set contains the field + if self.included is None and "included" in self.model_fields_set: + _dict['included'] = None + + # set to None if included_all (nullable) is None + # and model_fields_set contains the field + if self.included_all is None and "included_all" in self.model_fields_set: + _dict['included_all'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesGetResponseBodyApplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "excluded": [ApplicableTo.from_dict(_item) for _item in obj["excluded"]] if obj.get("excluded") is not None else None, + "included": [ApplicableTo.from_dict(_item) for _item in obj["included"]] if obj.get("included") is not None else None, + "included_all": obj.get("included_all") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_get_response_body_error.py b/voucherify/models/validation_rules_get_response_body_error.py new file mode 100644 index 00000000..49fb27aa --- /dev/null +++ b/voucherify/models/validation_rules_get_response_body_error.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesGetResponseBodyError(BaseModel): + """ + Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, description="The error message returned from API when validation / redemption fails to meet requirements of defined rules.") + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesGetResponseBodyError 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, + ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesGetResponseBodyError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_list_response_body.py b/voucherify/models/validation_rules_list_response_body.py new file mode 100644 index 00000000..6e53fdfc --- /dev/null +++ b/voucherify/models/validation_rules_list_response_body.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validation_rule import ValidationRule +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/validation-rules`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about validation rules.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of validation rules.") + data: Optional[List[ValidationRule]] = Field(default=None, description="An array of validation rules.") + total: Optional[StrictInt] = Field(default=None, description="Total number of validation rules in the project.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "total"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [ValidationRule.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_update_request_body.py b/voucherify/models/validation_rules_update_request_body.py new file mode 100644 index 00000000..7245966d --- /dev/null +++ b/voucherify/models/validation_rules_update_request_body.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.validation_rules_update_request_body_applicable_to import ValidationRulesUpdateRequestBodyApplicableTo +from voucherify.models.validation_rules_update_request_body_error import ValidationRulesUpdateRequestBodyError +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesUpdateRequestBody(BaseModel): + """ + Response body schema for **PUT** `v1/validation-rules/{validationRuleId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Custom, unique name for set of validation rules.") + rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions.") + error: Optional[ValidationRulesUpdateRequestBodyError] = None + applicable_to: Optional[ValidationRulesUpdateRequestBodyApplicableTo] = None + type: Optional[StrictStr] = Field(default='expression', description="Type of validation rule.") + context_type: Optional[StrictStr] = Field(default='global', description="Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | |") + __properties: ClassVar[List[str]] = ["name", "rules", "error", "applicable_to", "type", "context_type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expression', 'basic', 'advanced', 'complex']): + raise ValueError("must be one of enum values ('expression', 'basic', 'advanced', 'complex')") + return value + + @field_validator('context_type') + def context_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global']): + raise ValueError("must be one of enum values ('earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateRequestBody 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 error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + # set to None if applicable_to (nullable) is None + # and model_fields_set contains the field + if self.applicable_to is None and "applicable_to" in self.model_fields_set: + _dict['applicable_to'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if context_type (nullable) is None + # and model_fields_set contains the field + if self.context_type is None and "context_type" in self.model_fields_set: + _dict['context_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateRequestBody 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"), + "rules": obj.get("rules"), + "error": ValidationRulesUpdateRequestBodyError.from_dict(obj["error"]) if obj.get("error") is not None else None, + "applicable_to": ValidationRulesUpdateRequestBodyApplicableTo.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "type": obj.get("type") if obj.get("type") is not None else 'expression', + "context_type": obj.get("context_type") if obj.get("context_type") is not None else 'global' + }) + return _obj + + diff --git a/voucherify/models/validation_rules_update_request_body_applicable_to.py b/voucherify/models/validation_rules_update_request_body_applicable_to.py new file mode 100644 index 00000000..0e61a427 --- /dev/null +++ b/voucherify/models/validation_rules_update_request_body_applicable_to.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to import ApplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesUpdateRequestBodyApplicableTo(BaseModel): + """ + ValidationRulesUpdateRequestBodyApplicableTo + """ # noqa: E501 + excluded: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are excluded from a discount.") + included: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are included in a discount.") + included_all: Optional[StrictBool] = Field(default=None, description="Indicates whether all items are included in the discount.") + __properties: ClassVar[List[str]] = ["excluded", "included", "included_all"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateRequestBodyApplicableTo 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 excluded (list) + _items = [] + if self.excluded: + for _item_excluded in self.excluded: + if _item_excluded: + _items.append(_item_excluded.to_dict()) + _dict['excluded'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in included (list) + _items = [] + if self.included: + for _item_included in self.included: + if _item_included: + _items.append(_item_included.to_dict()) + _dict['included'] = _items + # set to None if excluded (nullable) is None + # and model_fields_set contains the field + if self.excluded is None and "excluded" in self.model_fields_set: + _dict['excluded'] = None + + # set to None if included (nullable) is None + # and model_fields_set contains the field + if self.included is None and "included" in self.model_fields_set: + _dict['included'] = None + + # set to None if included_all (nullable) is None + # and model_fields_set contains the field + if self.included_all is None and "included_all" in self.model_fields_set: + _dict['included_all'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateRequestBodyApplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "excluded": [ApplicableTo.from_dict(_item) for _item in obj["excluded"]] if obj.get("excluded") is not None else None, + "included": [ApplicableTo.from_dict(_item) for _item in obj["included"]] if obj.get("included") is not None else None, + "included_all": obj.get("included_all") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_update_request_body_error.py b/voucherify/models/validation_rules_update_request_body_error.py new file mode 100644 index 00000000..e5847e85 --- /dev/null +++ b/voucherify/models/validation_rules_update_request_body_error.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesUpdateRequestBodyError(BaseModel): + """ + Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, description="The error message returned from API when validation / redemption fails to meet requirements of defined rules.") + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateRequestBodyError 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, + ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateRequestBodyError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_update_response_body.py b/voucherify/models/validation_rules_update_response_body.py new file mode 100644 index 00000000..a82aa7db --- /dev/null +++ b/voucherify/models/validation_rules_update_response_body.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.validation_rules_update_response_body_applicable_to import ValidationRulesUpdateResponseBodyApplicableTo +from voucherify.models.validation_rules_update_response_body_error import ValidationRulesUpdateResponseBodyError +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/validation-rules/{validationRuleId}`. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Custom, unique name for set of validation rules.") + rules: Optional[Dict[str, Any]] = Field(default=None, description="Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consecutively beginning from `1`. The values are objects containing the rule conditions.") + error: Optional[ValidationRulesUpdateResponseBodyError] = None + applicable_to: Optional[ValidationRulesUpdateResponseBodyApplicableTo] = None + type: Optional[StrictStr] = Field(default='expression', description="Type of validation rule.") + context_type: Optional[StrictStr] = Field(default='global', description="Validation rule context type. | **Context Type** | **Definition** | |:---|:---| | earning_rule.order.paid | | | earning_rule.custom_event | | | earning_rule.customer.segment.entered | | | campaign.discount_coupons | | | campaign.discount_coupons.discount.apply_to_order | | | campaign.discount_coupons.discount.apply_to_items | | | campaign.discount_coupons.discount.apply_to_items_proportionally | | | campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | | | campaign.discount_coupons.discount.fixed.apply_to_items | | | campaign.gift_vouchers | | | campaign.gift_vouchers.gift.apply_to_order | | | campaign.gift_vouchers.gift.apply_to_items | | | campaign.referral_program | | | campaign.referral_program.discount.apply_to_order | | | campaign.referral_program.discount.apply_to_items | | | campaign.referral_program.discount.apply_to_items_proportionally | | | campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | | | campaign.referral_program.discount.fixed.apply_to_items | | | campaign.promotion | | | campaign.promotion.discount.apply_to_order | | | campaign.promotion.discount.apply_to_items | | | campaign.promotion.discount.apply_to_items_proportionally | | | campaign.promotion.discount.apply_to_items_proportionally_by_quantity | | | campaign.promotion.discount.fixed.apply_to_items | | | campaign.loyalty_program | | | campaign.lucky_draw | | | voucher.discount_voucher | | | voucher.discount_voucher.discount.apply_to_order | | | voucher.discount_voucher.discount.apply_to_items | | | voucher.discount_voucher.discount.apply_to_items_proportionally | | | voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | | | voucher.discount_voucher.discount.fixed.apply_to_items | | | voucher.gift_voucher | | | voucher.gift_voucher.gift.apply_to_order | | | voucher.gift_voucher.gift.apply_to_items | | | voucher.loyalty_card | | | voucher.lucky_draw_code | | | distribution.custom_event | | | reward_assignment.pay_with_points | | | global | |") + id: Optional[StrictStr] = Field(default=None, description="Unique validation rule ID.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the validation rule was updated. The value is shown in the ISO 8601 format.") + assignments_count: Optional[StrictInt] = Field(default=None, description="The number of instances the validation rule has been assigned to different types of redeemables.") + object: Optional[StrictStr] = Field(default='validation_rules', description="The type of the object represented by JSON. This object stores information about the validation rule.") + __properties: ClassVar[List[str]] = ["name", "rules", "error", "applicable_to", "type", "context_type", "id", "created_at", "updated_at", "assignments_count", "object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['expression', 'basic', 'advanced', 'complex']): + raise ValueError("must be one of enum values ('expression', 'basic', 'advanced', 'complex')") + return value + + @field_validator('context_type') + def context_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global']): + raise ValueError("must be one of enum values ('earning_rule.order.paid', 'earning_rule.custom_event', 'earning_rule.customer.segment.entered', 'earning_rule.customer.tier.joined', 'earning_rule.customer.tier.left', 'earning_rule.customer.tier.upgraded', 'earning_rule.customer.tier.downgraded', 'earning_rule.customer.tier.prolonged', 'campaign.discount_coupons', 'campaign.discount_coupons.discount.apply_to_order', 'campaign.discount_coupons.discount.apply_to_items', 'campaign.discount_coupons.discount.apply_to_items_proportionally', 'campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity', 'campaign.discount_coupons.discount.apply_to_items_by_quantity', 'campaign.discount_coupons.discount.fixed.apply_to_items', 'campaign.discount_coupons.discount.percent.apply_to_items', 'campaign.gift_vouchers', 'campaign.gift_vouchers.gift.apply_to_order', 'campaign.gift_vouchers.gift.apply_to_items', 'campaign.referral_program', 'campaign.referral_program.discount.apply_to_order', 'campaign.referral_program.discount.apply_to_items', 'campaign.referral_program.discount.apply_to_items_proportionally', 'campaign.referral_program.discount.apply_to_items_proportionally_by_quantity', 'campaign.referral_program.discount.apply_to_items_by_quantity', 'campaign.referral_program.discount.fixed.apply_to_items', 'campaign.referral_program.discount.percent.apply_to_items', 'campaign.promotion', 'campaign.promotion.discount.apply_to_order', 'campaign.promotion.discount.apply_to_items', 'campaign.promotion.discount.apply_to_items_proportionally', 'campaign.promotion.discount.apply_to_items_proportionally_by_quantity', 'campaign.promotion.discount.apply_to_items_by_quantity', 'campaign.promotion.discount.fixed.apply_to_items', 'campaign.promotion.discount.percent.apply_to_items', 'campaign.loyalty_program', 'campaign.lucky_draw', 'voucher.discount_voucher', 'voucher.discount_voucher.discount.apply_to_order', 'voucher.discount_voucher.discount.apply_to_items', 'voucher.discount_voucher.discount.apply_to_items_proportionally', 'voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity', 'voucher.discount_voucher.discount.apply_to_items_by_quantity', 'voucher.discount_voucher.discount.fixed.apply_to_items', 'voucher.discount_voucher.discount.percent.apply_to_items', 'voucher.gift_voucher', 'voucher.gift_voucher.gift.apply_to_order', 'voucher.gift_voucher.gift.apply_to_items', 'voucher.loyalty_card', 'voucher.lucky_draw_code', 'distribution.custom_event', 'distribution.order.paid', 'distribution.order.created', 'distribution.order.canceled', 'distribution.order.updated', 'reward_assignment.pay_with_points', 'global')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateResponseBody 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 error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + # set to None if applicable_to (nullable) is None + # and model_fields_set contains the field + if self.applicable_to is None and "applicable_to" in self.model_fields_set: + _dict['applicable_to'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if context_type (nullable) is None + # and model_fields_set contains the field + if self.context_type is None and "context_type" in self.model_fields_set: + _dict['context_type'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if assignments_count (nullable) is None + # and model_fields_set contains the field + if self.assignments_count is None and "assignments_count" in self.model_fields_set: + _dict['assignments_count'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateResponseBody 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"), + "rules": obj.get("rules"), + "error": ValidationRulesUpdateResponseBodyError.from_dict(obj["error"]) if obj.get("error") is not None else None, + "applicable_to": ValidationRulesUpdateResponseBodyApplicableTo.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "type": obj.get("type") if obj.get("type") is not None else 'expression', + "context_type": obj.get("context_type") if obj.get("context_type") is not None else 'global', + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "assignments_count": obj.get("assignments_count"), + "object": obj.get("object") if obj.get("object") is not None else 'validation_rules' + }) + return _obj + + diff --git a/voucherify/models/validation_rules_update_response_body_applicable_to.py b/voucherify/models/validation_rules_update_response_body_applicable_to.py new file mode 100644 index 00000000..af6a2833 --- /dev/null +++ b/voucherify/models/validation_rules_update_response_body_applicable_to.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.applicable_to import ApplicableTo +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesUpdateResponseBodyApplicableTo(BaseModel): + """ + ValidationRulesUpdateResponseBodyApplicableTo + """ # noqa: E501 + excluded: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are excluded from a discount.") + included: Optional[List[ApplicableTo]] = Field(default=None, description="Defines which items are included in a discount.") + included_all: Optional[StrictBool] = Field(default=None, description="Indicates whether all items are included in the discount.") + __properties: ClassVar[List[str]] = ["excluded", "included", "included_all"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateResponseBodyApplicableTo 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 excluded (list) + _items = [] + if self.excluded: + for _item_excluded in self.excluded: + if _item_excluded: + _items.append(_item_excluded.to_dict()) + _dict['excluded'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in included (list) + _items = [] + if self.included: + for _item_included in self.included: + if _item_included: + _items.append(_item_included.to_dict()) + _dict['included'] = _items + # set to None if excluded (nullable) is None + # and model_fields_set contains the field + if self.excluded is None and "excluded" in self.model_fields_set: + _dict['excluded'] = None + + # set to None if included (nullable) is None + # and model_fields_set contains the field + if self.included is None and "included" in self.model_fields_set: + _dict['included'] = None + + # set to None if included_all (nullable) is None + # and model_fields_set contains the field + if self.included_all is None and "included_all" in self.model_fields_set: + _dict['included_all'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateResponseBodyApplicableTo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "excluded": [ApplicableTo.from_dict(_item) for _item in obj["excluded"]] if obj.get("excluded") is not None else None, + "included": [ApplicableTo.from_dict(_item) for _item in obj["included"]] if obj.get("included") is not None else None, + "included_all": obj.get("included_all") + }) + return _obj + + diff --git a/voucherify/models/validation_rules_update_response_body_error.py b/voucherify/models/validation_rules_update_response_body_error.py new file mode 100644 index 00000000..089d110b --- /dev/null +++ b/voucherify/models/validation_rules_update_response_body_error.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationRulesUpdateResponseBodyError(BaseModel): + """ + Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules. + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, description="The error message returned from API when validation / redemption fails to meet requirements of defined rules.") + __properties: ClassVar[List[str]] = ["message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateResponseBodyError 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, + ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationRulesUpdateResponseBodyError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validations_redeemable_inapplicable.py b/voucherify/models/validations_redeemable_inapplicable.py new file mode 100644 index 00000000..6f12c75c --- /dev/null +++ b/voucherify/models/validations_redeemable_inapplicable.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.category import Category +from voucherify.models.validations_redeemable_inapplicable_result import ValidationsRedeemableInapplicableResult +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsRedeemableInapplicable(BaseModel): + """ + ValidationsRedeemableInapplicable + """ # noqa: E501 + status: Optional[StrictStr] = Field(default='INAPPLICABLE', description="Indicates whether the redeemable can be applied or not applied based on the validation rules.") + id: Optional[StrictStr] = Field(default=None, description="Redeemable ID, i.e. the voucher code.") + object: Optional[StrictStr] = Field(default=None, description="Redeemable's object type.") + result: Optional[ValidationsRedeemableInapplicableResult] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["status", "id", "object", "result", "metadata", "categories"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['INAPPLICABLE']): + raise ValueError("must be one of enum values ('INAPPLICABLE')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsRedeemableInapplicable 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 result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsRedeemableInapplicable from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status") if obj.get("status") is not None else 'INAPPLICABLE', + "id": obj.get("id"), + "object": obj.get("object"), + "result": ValidationsRedeemableInapplicableResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "metadata": obj.get("metadata"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_redeemable_inapplicable_result.py b/voucherify/models/validations_redeemable_inapplicable_result.py new file mode 100644 index 00000000..49e12bd3 --- /dev/null +++ b/voucherify/models/validations_redeemable_inapplicable_result.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.error import Error +from voucherify.models.validations_redeemable_inapplicable_result_details import ValidationsRedeemableInapplicableResultDetails +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsRedeemableInapplicableResult(BaseModel): + """ + Includes the error object with details about the reason why the redeemable is inapplicable + """ # noqa: E501 + error: Optional[Error] = None + details: Optional[ValidationsRedeemableInapplicableResultDetails] = None + __properties: ClassVar[List[str]] = ["error", "details"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsRedeemableInapplicableResult 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 error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of details + if self.details: + _dict['details'] = self.details.to_dict() + # set to None if details (nullable) is None + # and model_fields_set contains the field + if self.details is None and "details" in self.model_fields_set: + _dict['details'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsRedeemableInapplicableResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "error": Error.from_dict(obj["error"]) if obj.get("error") is not None else None, + "details": ValidationsRedeemableInapplicableResultDetails.from_dict(obj["details"]) if obj.get("details") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_redeemable_inapplicable_result_details.py b/voucherify/models/validations_redeemable_inapplicable_result_details.py new file mode 100644 index 00000000..2d9e5a73 --- /dev/null +++ b/voucherify/models/validations_redeemable_inapplicable_result_details.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsRedeemableInapplicableResultDetails(BaseModel): + """ + Provides details about the reason why the redeemable is inapplicable. + """ # noqa: E501 + message: Optional[StrictStr] = Field(default=None, description="Generic message from the `message` string shown in the `error` object or the message configured in a validation rule.") + key: Optional[StrictStr] = Field(default=None, description="Generic message from the `key` string shown in the `error` object.") + __properties: ClassVar[List[str]] = ["message", "key"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsRedeemableInapplicableResultDetails 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, + ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + # set to None if key (nullable) is None + # and model_fields_set contains the field + if self.key is None and "key" in self.model_fields_set: + _dict['key'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsRedeemableInapplicableResultDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message"), + "key": obj.get("key") + }) + return _obj + + diff --git a/voucherify/models/validations_redeemable_skipped.py b/voucherify/models/validations_redeemable_skipped.py new file mode 100644 index 00000000..69d5af8b --- /dev/null +++ b/voucherify/models/validations_redeemable_skipped.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.category import Category +from voucherify.models.validations_redeemable_skipped_result import ValidationsRedeemableSkippedResult +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsRedeemableSkipped(BaseModel): + """ + ValidationsRedeemableSkipped + """ # noqa: E501 + status: Optional[StrictStr] = Field(default='SKIPPED', description="Indicates whether the redeemable can be applied or not applied based on the validation rules.") + id: Optional[StrictStr] = Field(default=None, description="Redeemable ID, i.e. the voucher code.") + object: Optional[StrictStr] = Field(default=None, description="Redeemable's object type.") + result: Optional[ValidationsRedeemableSkippedResult] = None + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable.") + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["status", "id", "object", "result", "metadata", "categories"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SKIPPED']): + raise ValueError("must be one of enum values ('SKIPPED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsRedeemableSkipped 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 result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsRedeemableSkipped from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status") if obj.get("status") is not None else 'SKIPPED', + "id": obj.get("id"), + "object": obj.get("object"), + "result": ValidationsRedeemableSkippedResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "metadata": obj.get("metadata"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_redeemable_skipped_result.py b/voucherify/models/validations_redeemable_skipped_result.py new file mode 100644 index 00000000..cf77cfaa --- /dev/null +++ b/voucherify/models/validations_redeemable_skipped_result.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validations_redeemable_skipped_result_details import ValidationsRedeemableSkippedResultDetails +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsRedeemableSkippedResult(BaseModel): + """ + Provides details about the reason why the redeemable is skipped. + """ # noqa: E501 + details: Optional[ValidationsRedeemableSkippedResultDetails] = None + __properties: ClassVar[List[str]] = ["details"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsRedeemableSkippedResult 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() + # set to None if details (nullable) is None + # and model_fields_set contains the field + if self.details is None and "details" in self.model_fields_set: + _dict['details'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsRedeemableSkippedResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "details": ValidationsRedeemableSkippedResultDetails.from_dict(obj["details"]) if obj.get("details") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_redeemable_skipped_result_details.py b/voucherify/models/validations_redeemable_skipped_result_details.py new file mode 100644 index 00000000..264e8664 --- /dev/null +++ b/voucherify/models/validations_redeemable_skipped_result_details.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsRedeemableSkippedResultDetails(BaseModel): + """ + ValidationsRedeemableSkippedResultDetails + """ # noqa: E501 + key: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["key", "message"] + + @field_validator('key') + def key_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['applicable_redeemables_limit_exceeded', 'applicable_redeemables_per_category_limit_exceeded', 'applicable_exclusive_redeemables_limit_exceeded', 'applicable_exclusive_redeemables_per_category_limit_exceeded', 'exclusion_rules_not_met', 'preceding_validation_failed']): + raise ValueError("must be one of enum values ('applicable_redeemables_limit_exceeded', 'applicable_redeemables_per_category_limit_exceeded', 'applicable_exclusive_redeemables_limit_exceeded', 'applicable_exclusive_redeemables_per_category_limit_exceeded', 'exclusion_rules_not_met', 'preceding_validation_failed')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsRedeemableSkippedResultDetails 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, + ) + # set to None if key (nullable) is None + # and model_fields_set contains the field + if self.key is None and "key" in self.model_fields_set: + _dict['key'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsRedeemableSkippedResultDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_request_body.py b/voucherify/models/validations_validate_request_body.py new file mode 100644 index 00000000..ab07db8c --- /dev/null +++ b/voucherify/models/validations_validate_request_body.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.customer import Customer +from voucherify.models.order import Order +from voucherify.models.session import Session +from voucherify.models.validations_validate_request_body_options import ValidationsValidateRequestBodyOptions +from voucherify.models.validations_validate_request_body_redeemables_item import ValidationsValidateRequestBodyRedeemablesItem +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateRequestBody(BaseModel): + """ + Response body schema for **POST** `v1/validations`. + """ # noqa: E501 + options: Optional[ValidationsValidateRequestBodyOptions] = None + redeemables: Optional[List[ValidationsValidateRequestBodyRedeemablesItem]] = None + order: Optional[Order] = None + customer: Optional[Customer] = None + session: Optional[Session] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Is correspondent to Customer's source_id") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format.") + __properties: ClassVar[List[str]] = ["options", "redeemables", "order", "customer", "session", "tracking_id", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBody 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 options + if self.options: + _dict['options'] = self.options.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in redeemables (list) + _items = [] + if self.redeemables: + for _item_redeemables in self.redeemables: + if _item_redeemables: + _items.append(_item_redeemables.to_dict()) + _dict['redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + # override the default output from pydantic by calling `to_dict()` of session + if self.session: + _dict['session'] = self.session.to_dict() + # set to None if options (nullable) is None + # and model_fields_set contains the field + if self.options is None and "options" in self.model_fields_set: + _dict['options'] = None + + # set to None if redeemables (nullable) is None + # and model_fields_set contains the field + if self.redeemables is None and "redeemables" in self.model_fields_set: + _dict['redeemables'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "options": ValidationsValidateRequestBodyOptions.from_dict(obj["options"]) if obj.get("options") is not None else None, + "redeemables": [ValidationsValidateRequestBodyRedeemablesItem.from_dict(_item) for _item in obj["redeemables"]] if obj.get("redeemables") is not None else None, + "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None, + "customer": Customer.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "session": Session.from_dict(obj["session"]) if obj.get("session") is not None else None, + "tracking_id": obj.get("tracking_id"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_request_body_options.py b/voucherify/models/validations_validate_request_body_options.py new file mode 100644 index 00000000..d5939cd0 --- /dev/null +++ b/voucherify/models/validations_validate_request_body_options.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class ValidationsValidateRequestBodyOptions(BaseModel): + """ + Configure parameters returned in the response. + """ # noqa: E501 + expand: Optional[List[StrictStr]] = Field(default=None, description="The expand array lets you configure the parameters included in the response. Depending on the strings included in the array, the response will contain different details. | **Expand Option** | **Response Body** | |:---|:---| | [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. | | [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. | | [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. | | [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |") + __properties: ClassVar[List[str]] = ["expand"] + + @field_validator('expand') + def expand_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['order', 'redemption', 'redeemable', 'category']): + raise ValueError("each list item must be one of ('order', 'redemption', 'redeemable', 'category')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyOptions 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, + ) + # set to None if expand (nullable) is None + # and model_fields_set contains the field + if self.expand is None and "expand" in self.model_fields_set: + _dict['expand'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyOptions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expand": obj.get("expand") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_request_body_redeemables_item.py b/voucherify/models/validations_validate_request_body_redeemables_item.py new file mode 100644 index 00000000..19058230 --- /dev/null +++ b/voucherify/models/validations_validate_request_body_redeemables_item.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validations_validate_request_body_redeemables_item_gift import ValidationsValidateRequestBodyRedeemablesItemGift +from voucherify.models.validations_validate_request_body_redeemables_item_reward import ValidationsValidateRequestBodyRedeemablesItemReward +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateRequestBodyRedeemablesItem(BaseModel): + """ + ValidationsValidateRequestBodyRedeemablesItem + """ # noqa: E501 + object: Optional[StrictStr] = None + id: Optional[StrictStr] = None + gift: Optional[ValidationsValidateRequestBodyRedeemablesItemGift] = None + reward: Optional[ValidationsValidateRequestBodyRedeemablesItemReward] = None + __properties: ClassVar[List[str]] = ["object", "id", "gift", "reward"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier', 'promotion_stack']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier', 'promotion_stack')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyRedeemablesItem 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 gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyRedeemablesItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object"), + "id": obj.get("id"), + "gift": ValidationsValidateRequestBodyRedeemablesItemGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "reward": ValidationsValidateRequestBodyRedeemablesItemReward.from_dict(obj["reward"]) if obj.get("reward") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_validate_request_body_redeemables_item_gift.py b/voucherify/models/validations_validate_request_body_redeemables_item_gift.py new file mode 100644 index 00000000..e0ce06e9 --- /dev/null +++ b/voucherify/models/validations_validate_request_body_redeemables_item_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateRequestBodyRedeemablesItemGift(BaseModel): + """ + Contains information on the number of gift card credits that the customer wants to apply to the order. + """ # noqa: E501 + credits: Optional[StrictInt] = Field(default=None, description="The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example `10000 cents` for `$100.00`.") + __properties: ClassVar[List[str]] = ["credits"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyRedeemablesItemGift 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, + ) + # set to None if credits (nullable) is None + # and model_fields_set contains the field + if self.credits is None and "credits" in self.model_fields_set: + _dict['credits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyRedeemablesItemGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "credits": obj.get("credits") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_request_body_redeemables_item_reward.py b/voucherify/models/validations_validate_request_body_redeemables_item_reward.py new file mode 100644 index 00000000..b5a4983d --- /dev/null +++ b/voucherify/models/validations_validate_request_body_redeemables_item_reward.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateRequestBodyRedeemablesItemReward(BaseModel): + """ + Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.") + points: Optional[StrictInt] = Field(default=None, description="The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card.") + __properties: ClassVar[List[str]] = ["id", "points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyRedeemablesItemReward 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateRequestBodyRedeemablesItemReward 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"), + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body.py b/voucherify/models/validations_validate_response_body.py new file mode 100644 index 00000000..973dc877 --- /dev/null +++ b/voucherify/models/validations_validate_response_body.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.order_calculated import OrderCalculated +from voucherify.models.session import Session +from voucherify.models.stacking_rules import StackingRules +from voucherify.models.validations_redeemable_inapplicable import ValidationsRedeemableInapplicable +from voucherify.models.validations_redeemable_skipped import ValidationsRedeemableSkipped +from voucherify.models.validations_validate_response_body_redeemables_item import ValidationsValidateResponseBodyRedeemablesItem +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBody(BaseModel): + """ + Response body schema for POST `/validations`. + """ # noqa: E501 + valid: Optional[StrictBool] = Field(default=None, description="The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.") + redeemables: Optional[List[ValidationsValidateResponseBodyRedeemablesItem]] = None + skipped_redeemables: Optional[List[ValidationsRedeemableSkipped]] = Field(default=None, description="Lists validation results of each skipped redeemable.") + inapplicable_redeemables: Optional[List[ValidationsRedeemableInapplicable]] = Field(default=None, description="Lists validation results of each inapplicable redeemable.") + order: Optional[OrderCalculated] = None + tracking_id: Optional[StrictStr] = Field(default=None, description="Hashed customer source ID.") + session: Optional[Session] = None + stacking_rules: StackingRules + __properties: ClassVar[List[str]] = ["valid", "redeemables", "skipped_redeemables", "inapplicable_redeemables", "order", "tracking_id", "session", "stacking_rules"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBody 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 redeemables (list) + _items = [] + if self.redeemables: + for _item_redeemables in self.redeemables: + if _item_redeemables: + _items.append(_item_redeemables.to_dict()) + _dict['redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in skipped_redeemables (list) + _items = [] + if self.skipped_redeemables: + for _item_skipped_redeemables in self.skipped_redeemables: + if _item_skipped_redeemables: + _items.append(_item_skipped_redeemables.to_dict()) + _dict['skipped_redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in inapplicable_redeemables (list) + _items = [] + if self.inapplicable_redeemables: + for _item_inapplicable_redeemables in self.inapplicable_redeemables: + if _item_inapplicable_redeemables: + _items.append(_item_inapplicable_redeemables.to_dict()) + _dict['inapplicable_redeemables'] = _items + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of session + if self.session: + _dict['session'] = self.session.to_dict() + # override the default output from pydantic by calling `to_dict()` of stacking_rules + if self.stacking_rules: + _dict['stacking_rules'] = self.stacking_rules.to_dict() + # set to None if valid (nullable) is None + # and model_fields_set contains the field + if self.valid is None and "valid" in self.model_fields_set: + _dict['valid'] = None + + # set to None if redeemables (nullable) is None + # and model_fields_set contains the field + if self.redeemables is None and "redeemables" in self.model_fields_set: + _dict['redeemables'] = None + + # set to None if skipped_redeemables (nullable) is None + # and model_fields_set contains the field + if self.skipped_redeemables is None and "skipped_redeemables" in self.model_fields_set: + _dict['skipped_redeemables'] = None + + # set to None if inapplicable_redeemables (nullable) is None + # and model_fields_set contains the field + if self.inapplicable_redeemables is None and "inapplicable_redeemables" in self.model_fields_set: + _dict['inapplicable_redeemables'] = None + + # set to None if tracking_id (nullable) is None + # and model_fields_set contains the field + if self.tracking_id is None and "tracking_id" in self.model_fields_set: + _dict['tracking_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "valid": obj.get("valid"), + "redeemables": [ValidationsValidateResponseBodyRedeemablesItem.from_dict(_item) for _item in obj["redeemables"]] if obj.get("redeemables") is not None else None, + "skipped_redeemables": [ValidationsRedeemableSkipped.from_dict(_item) for _item in obj["skipped_redeemables"]] if obj.get("skipped_redeemables") is not None else None, + "inapplicable_redeemables": [ValidationsRedeemableInapplicable.from_dict(_item) for _item in obj["inapplicable_redeemables"]] if obj.get("inapplicable_redeemables") is not None else None, + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "tracking_id": obj.get("tracking_id"), + "session": Session.from_dict(obj["session"]) if obj.get("session") is not None else None, + "stacking_rules": StackingRules.from_dict(obj["stacking_rules"]) if obj.get("stacking_rules") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body_redeemables_item.py b/voucherify/models/validations_validate_response_body_redeemables_item.py new file mode 100644 index 00000000..ae64bd3e --- /dev/null +++ b/voucherify/models/validations_validate_response_body_redeemables_item.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.applicable_to_result_list import ApplicableToResultList +from voucherify.models.category import Category +from voucherify.models.inapplicable_to_result_list import InapplicableToResultList +from voucherify.models.order_calculated import OrderCalculated +from voucherify.models.validations_validate_response_body_redeemables_item_result import ValidationsValidateResponseBodyRedeemablesItemResult +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBodyRedeemablesItem(BaseModel): + """ + ValidationsValidateResponseBodyRedeemablesItem + """ # noqa: E501 + status: Optional[StrictStr] = None + id: Optional[StrictStr] = Field(default=None, description="Redeemable ID, i.e. the voucher code.") + object: Optional[StrictStr] = Field(default=None, description="Redeemable's object type.") + order: Optional[OrderCalculated] = None + applicable_to: Optional[ApplicableToResultList] = None + inapplicable_to: Optional[InapplicableToResultList] = None + result: Optional[ValidationsValidateResponseBodyRedeemablesItemResult] = None + metadata: Optional[Dict[str, Any]] = None + categories: Optional[List[Category]] = None + __properties: ClassVar[List[str]] = ["status", "id", "object", "order", "applicable_to", "inapplicable_to", "result", "metadata", "categories"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLICABLE', 'INAPPLICABLE', 'SKIPPED']): + raise ValueError("must be one of enum values ('APPLICABLE', 'INAPPLICABLE', 'SKIPPED')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher', 'promotion_tier']): + raise ValueError("must be one of enum values ('voucher', 'promotion_tier')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItem 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 order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of applicable_to + if self.applicable_to: + _dict['applicable_to'] = self.applicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of inapplicable_to + if self.inapplicable_to: + _dict['inapplicable_to'] = self.inapplicable_to.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status"), + "id": obj.get("id"), + "object": obj.get("object"), + "order": OrderCalculated.from_dict(obj["order"]) if obj.get("order") is not None else None, + "applicable_to": ApplicableToResultList.from_dict(obj["applicable_to"]) if obj.get("applicable_to") is not None else None, + "inapplicable_to": InapplicableToResultList.from_dict(obj["inapplicable_to"]) if obj.get("inapplicable_to") is not None else None, + "result": ValidationsValidateResponseBodyRedeemablesItemResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "metadata": obj.get("metadata"), + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body_redeemables_item_result.py b/voucherify/models/validations_validate_response_body_redeemables_item_result.py new file mode 100644 index 00000000..4d781355 --- /dev/null +++ b/voucherify/models/validations_validate_response_body_redeemables_item_result.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.error import Error +from voucherify.models.validations_validate_response_body_redeemables_item_result_details import ValidationsValidateResponseBodyRedeemablesItemResultDetails +from voucherify.models.validations_validate_response_body_redeemables_item_result_discount import ValidationsValidateResponseBodyRedeemablesItemResultDiscount +from voucherify.models.validations_validate_response_body_redeemables_item_result_gift import ValidationsValidateResponseBodyRedeemablesItemResultGift +from voucherify.models.validations_validate_response_body_redeemables_item_result_loyalty_card import ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBodyRedeemablesItemResult(BaseModel): + """ + ValidationsValidateResponseBodyRedeemablesItemResult + """ # noqa: E501 + discount: Optional[ValidationsValidateResponseBodyRedeemablesItemResultDiscount] = None + gift: Optional[ValidationsValidateResponseBodyRedeemablesItemResultGift] = None + loyalty_card: Optional[ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard] = None + error: Optional[Error] = None + details: Optional[ValidationsValidateResponseBodyRedeemablesItemResultDetails] = None + __properties: ClassVar[List[str]] = ["discount", "gift", "loyalty_card", "error", "details"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResult 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of error + if self.error: + _dict['error'] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of details + if self.details: + _dict['details'] = self.details.to_dict() + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "discount": ValidationsValidateResponseBodyRedeemablesItemResultDiscount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": ValidationsValidateResponseBodyRedeemablesItemResultGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "error": Error.from_dict(obj["error"]) if obj.get("error") is not None else None, + "details": ValidationsValidateResponseBodyRedeemablesItemResultDetails.from_dict(obj["details"]) if obj.get("details") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body_redeemables_item_result_details.py b/voucherify/models/validations_validate_response_body_redeemables_item_result_details.py new file mode 100644 index 00000000..3b0f9ef4 --- /dev/null +++ b/voucherify/models/validations_validate_response_body_redeemables_item_result_details.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBodyRedeemablesItemResultDetails(BaseModel): + """ + ValidationsValidateResponseBodyRedeemablesItemResultDetails + """ # noqa: E501 + key: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["key", "message"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultDetails 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 ValidationsValidateResponseBodyRedeemablesItemResultDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "key": obj.get("key"), + "message": obj.get("message") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body_redeemables_item_result_discount.py b/voucherify/models/validations_validate_response_body_redeemables_item_result_discount.py new file mode 100644 index 00000000..5e4929c1 --- /dev/null +++ b/voucherify/models/validations_validate_response_body_redeemables_item_result_discount.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from voucherify.models.discount_unit_multiple_one_unit import DiscountUnitMultipleOneUnit +from voucherify.models.simple_sku_discount_unit import SimpleSkuDiscountUnit +from voucherify.models.validations_validate_response_body_redeemables_item_result_discount_product import ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBodyRedeemablesItemResultDiscount(BaseModel): + """ + ValidationsValidateResponseBodyRedeemablesItemResultDiscount + """ # noqa: E501 + type: Optional[StrictStr] = None + amount_off: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000.") + amount_off_formula: Optional[StrictStr] = None + aggregated_amount_limit: Optional[StrictInt] = Field(default=None, description="Maximum discount amount per order.") + effect: Optional[StrictStr] = None + is_dynamic: Optional[StrictBool] = Field(default=None, description="Flag indicating whether the discount was calculated using a formula.") + unit_off: Optional[StrictInt] = Field(default=None, description="Number of units to be granted a full value discount.") + unit_off_formula: Optional[StrictStr] = None + unit_type: Optional[StrictStr] = Field(default=None, description="The product deemed as free, chosen from product inventory (e.g. time, items).") + product: Optional[ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct] = None + sku: Optional[SimpleSkuDiscountUnit] = None + units: Optional[List[DiscountUnitMultipleOneUnit]] = None + percent_off: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The percent discount that the customer will receive.") + percent_off_formula: Optional[StrictStr] = None + amount_limit: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.") + fixed_amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value.") + fixed_amount_formula: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type", "amount_off", "amount_off_formula", "aggregated_amount_limit", "effect", "is_dynamic", "unit_off", "unit_off_formula", "unit_type", "product", "sku", "units", "percent_off", "percent_off_formula", "amount_limit", "fixed_amount", "fixed_amount_formula"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['AMOUNT', 'UNIT', 'PERCENT', 'FIXED']): + raise ValueError("must be one of enum values ('AMOUNT', 'UNIT', 'PERCENT', 'FIXED')") + return value + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS', 'APPLY_TO_ITEMS_PROPORTIONALLY', 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY', 'APPLY_TO_ITEMS_BY_QUANTITY', 'ADD_MISSING_ITEMS', 'ADD_NEW_ITEMS', 'ADD_MANY_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS', 'APPLY_TO_ITEMS_PROPORTIONALLY', 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY', 'APPLY_TO_ITEMS_BY_QUANTITY', 'ADD_MISSING_ITEMS', 'ADD_NEW_ITEMS', 'ADD_MANY_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultDiscount 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 product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of sku + if self.sku: + _dict['sku'] = self.sku.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in units (list) + _items = [] + if self.units: + for _item_units in self.units: + if _item_units: + _items.append(_item_units.to_dict()) + _dict['units'] = _items + # set to None if amount_off (nullable) is None + # and model_fields_set contains the field + if self.amount_off is None and "amount_off" in self.model_fields_set: + _dict['amount_off'] = None + + # set to None if amount_off_formula (nullable) is None + # and model_fields_set contains the field + if self.amount_off_formula is None and "amount_off_formula" in self.model_fields_set: + _dict['amount_off_formula'] = None + + # set to None if aggregated_amount_limit (nullable) is None + # and model_fields_set contains the field + if self.aggregated_amount_limit is None and "aggregated_amount_limit" in self.model_fields_set: + _dict['aggregated_amount_limit'] = None + + # set to None if is_dynamic (nullable) is None + # and model_fields_set contains the field + if self.is_dynamic is None and "is_dynamic" in self.model_fields_set: + _dict['is_dynamic'] = None + + # set to None if unit_off (nullable) is None + # and model_fields_set contains the field + if self.unit_off is None and "unit_off" in self.model_fields_set: + _dict['unit_off'] = None + + # set to None if unit_off_formula (nullable) is None + # and model_fields_set contains the field + if self.unit_off_formula is None and "unit_off_formula" in self.model_fields_set: + _dict['unit_off_formula'] = None + + # set to None if unit_type (nullable) is None + # and model_fields_set contains the field + if self.unit_type is None and "unit_type" in self.model_fields_set: + _dict['unit_type'] = None + + # set to None if units (nullable) is None + # and model_fields_set contains the field + if self.units is None and "units" in self.model_fields_set: + _dict['units'] = None + + # set to None if percent_off (nullable) is None + # and model_fields_set contains the field + if self.percent_off is None and "percent_off" in self.model_fields_set: + _dict['percent_off'] = None + + # set to None if percent_off_formula (nullable) is None + # and model_fields_set contains the field + if self.percent_off_formula is None and "percent_off_formula" in self.model_fields_set: + _dict['percent_off_formula'] = None + + # set to None if amount_limit (nullable) is None + # and model_fields_set contains the field + if self.amount_limit is None and "amount_limit" in self.model_fields_set: + _dict['amount_limit'] = None + + # set to None if fixed_amount (nullable) is None + # and model_fields_set contains the field + if self.fixed_amount is None and "fixed_amount" in self.model_fields_set: + _dict['fixed_amount'] = None + + # set to None if fixed_amount_formula (nullable) is None + # and model_fields_set contains the field + if self.fixed_amount_formula is None and "fixed_amount_formula" in self.model_fields_set: + _dict['fixed_amount_formula'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultDiscount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "amount_off": obj.get("amount_off"), + "amount_off_formula": obj.get("amount_off_formula"), + "aggregated_amount_limit": obj.get("aggregated_amount_limit"), + "effect": obj.get("effect"), + "is_dynamic": obj.get("is_dynamic"), + "unit_off": obj.get("unit_off"), + "unit_off_formula": obj.get("unit_off_formula"), + "unit_type": obj.get("unit_type"), + "product": ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sku": SimpleSkuDiscountUnit.from_dict(obj["sku"]) if obj.get("sku") is not None else None, + "units": [DiscountUnitMultipleOneUnit.from_dict(_item) for _item in obj["units"]] if obj.get("units") is not None else None, + "percent_off": obj.get("percent_off"), + "percent_off_formula": obj.get("percent_off_formula"), + "amount_limit": obj.get("amount_limit"), + "fixed_amount": obj.get("fixed_amount"), + "fixed_amount_formula": obj.get("fixed_amount_formula") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body_redeemables_item_result_discount_product.py b/voucherify/models/validations_validate_response_body_redeemables_item_result_discount_product.py new file mode 100644 index 00000000..910f1a47 --- /dev/null +++ b/voucherify/models/validations_validate_response_body_redeemables_item_result_discount_product.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct(BaseModel): + """ + ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique product ID, assigned by Voucherify.") + source_id: Optional[StrictStr] = Field(default=None, description="Product's source ID.") + name: Optional[StrictStr] = Field(default=None, description="Product name.") + __properties: ClassVar[List[str]] = ["id", "source_id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultDiscountProduct 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"), + "source_id": obj.get("source_id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body_redeemables_item_result_gift.py b/voucherify/models/validations_validate_response_body_redeemables_item_result_gift.py new file mode 100644 index 00000000..63d6bd3e --- /dev/null +++ b/voucherify/models/validations_validate_response_body_redeemables_item_result_gift.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBodyRedeemablesItemResultGift(BaseModel): + """ + Stores the amount of gift card credits to be applied in the redemption. + """ # noqa: E501 + credits: Optional[StrictInt] = Field(default=None, description="Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (e.g. 100 cents for $1.00).") + __properties: ClassVar[List[str]] = ["credits"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultGift 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, + ) + # set to None if credits (nullable) is None + # and model_fields_set contains the field + if self.credits is None and "credits" in self.model_fields_set: + _dict['credits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "credits": obj.get("credits") + }) + return _obj + + diff --git a/voucherify/models/validations_validate_response_body_redeemables_item_result_loyalty_card.py b/voucherify/models/validations_validate_response_body_redeemables_item_result_loyalty_card.py new file mode 100644 index 00000000..c005f1dc --- /dev/null +++ b/voucherify/models/validations_validate_response_body_redeemables_item_result_loyalty_card.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard(BaseModel): + """ + ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total number of loyalty points to be applied in the redemption.") + __properties: ClassVar[List[str]] = ["points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationsValidateResponseBodyRedeemablesItemResultLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points") + }) + return _obj + + diff --git a/voucherify/models/validity_hours.py b/voucherify/models/validity_hours.py new file mode 100644 index 00000000..8aeeb7a4 --- /dev/null +++ b/voucherify/models/validity_hours.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.validity_hours_daily_item import ValidityHoursDailyItem +from typing import Optional, Set +from typing_extensions import Self + +class ValidityHours(BaseModel): + """ + Determines the hours of validity, e.g. to create a happy hours scenario. + """ # noqa: E501 + daily: Optional[List[ValidityHoursDailyItem]] = Field(default=None, description="Defines the reccuring period(s) when the resource is active. The periods should not overlap.") + __properties: ClassVar[List[str]] = ["daily"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidityHours 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 daily (list) + _items = [] + if self.daily: + for _item_daily in self.daily: + if _item_daily: + _items.append(_item_daily.to_dict()) + _dict['daily'] = _items + # set to None if daily (nullable) is None + # and model_fields_set contains the field + if self.daily is None and "daily" in self.model_fields_set: + _dict['daily'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidityHours from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "daily": [ValidityHoursDailyItem.from_dict(_item) for _item in obj["daily"]] if obj.get("daily") is not None else None + }) + return _obj + + diff --git a/voucherify/models/validity_hours_daily_item.py b/voucherify/models/validity_hours_daily_item.py new file mode 100644 index 00000000..85a73652 --- /dev/null +++ b/voucherify/models/validity_hours_daily_item.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class ValidityHoursDailyItem(BaseModel): + """ + Defines the reccuring period(s) when the resource will be active. + """ # noqa: E501 + start_time: Optional[StrictStr] = Field(default=None, description="Defines the starting hour of validity in the HH:mm format. The resource is *inactive before* this time.") + days_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the resource is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + expiration_time: Optional[StrictStr] = Field(default=None, description="Defines the ending hour of validity in the HH:mm format. The resource is *inactive after* this time.") + __properties: ClassVar[List[str]] = ["start_time", "days_of_week", "expiration_time"] + + @field_validator('days_of_week') + def days_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidityHoursDailyItem 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 ValidityHoursDailyItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "start_time": obj.get("start_time"), + "days_of_week": obj.get("days_of_week"), + "expiration_time": obj.get("expiration_time") + }) + return _obj + + diff --git a/voucherify/models/validity_timeframe.py b/voucherify/models/validity_timeframe.py new file mode 100644 index 00000000..7589bade --- /dev/null +++ b/voucherify/models/validity_timeframe.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValidityTimeframe(BaseModel): + """ + Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`. + """ # noqa: E501 + duration: Optional[StrictStr] = Field(default=None, description="Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.") + interval: Optional[StrictStr] = Field(default=None, description="Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.") + __properties: ClassVar[List[str]] = ["duration", "interval"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidityTimeframe 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, + ) + # set to None if duration (nullable) is None + # and model_fields_set contains the field + if self.duration is None and "duration" in self.model_fields_set: + _dict['duration'] = None + + # set to None if interval (nullable) is None + # and model_fields_set contains the field + if self.interval is None and "interval" in self.model_fields_set: + _dict['interval'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidityTimeframe from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "duration": obj.get("duration"), + "interval": obj.get("interval") + }) + return _obj + + diff --git a/voucherify/models/voucher.py b/voucherify/models/voucher.py new file mode 100644 index 00000000..28755240 --- /dev/null +++ b/voucherify/models/voucher.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.voucher_gift import VoucherGift +from voucherify.models.voucher_loyalty_card import VoucherLoyaltyCard +from voucherify.models.voucher_publish import VoucherPublish +from voucherify.models.voucher_redemption import VoucherRedemption +from typing import Optional, Set +from typing_extensions import Self + +class Voucher(BaseModel): + """ + This is an object representing a voucher with categories and validation rules assignments. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[VoucherGift] = None + loyalty_card: Optional[VoucherLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[VoucherPublish] = None + redemption: Optional[VoucherRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Voucher 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Voucher 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": VoucherGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": VoucherLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": VoucherPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": VoucherRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_assets.py b/voucherify/models/voucher_assets.py new file mode 100644 index 00000000..a96ab240 --- /dev/null +++ b/voucherify/models/voucher_assets.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.voucher_assets_barcode import VoucherAssetsBarcode +from voucherify.models.voucher_assets_qr import VoucherAssetsQr +from typing import Optional, Set +from typing_extensions import Self + +class VoucherAssets(BaseModel): + """ + Stores links to images of QR and barcode that correspond to an encrypted voucher code. + """ # noqa: E501 + qr: Optional[VoucherAssetsQr] = None + barcode: Optional[VoucherAssetsBarcode] = None + __properties: ClassVar[List[str]] = ["qr", "barcode"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherAssets 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 qr + if self.qr: + _dict['qr'] = self.qr.to_dict() + # override the default output from pydantic by calling `to_dict()` of barcode + if self.barcode: + _dict['barcode'] = self.barcode.to_dict() + # set to None if qr (nullable) is None + # and model_fields_set contains the field + if self.qr is None and "qr" in self.model_fields_set: + _dict['qr'] = None + + # set to None if barcode (nullable) is None + # and model_fields_set contains the field + if self.barcode is None and "barcode" in self.model_fields_set: + _dict['barcode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherAssets from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "qr": VoucherAssetsQr.from_dict(obj["qr"]) if obj.get("qr") is not None else None, + "barcode": VoucherAssetsBarcode.from_dict(obj["barcode"]) if obj.get("barcode") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_assets_barcode.py b/voucherify/models/voucher_assets_barcode.py new file mode 100644 index 00000000..c2a14657 --- /dev/null +++ b/voucherify/models/voucher_assets_barcode.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherAssetsBarcode(BaseModel): + """ + Stores barcode representation of encrypted code. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Encrypted voucher code ID.") + url: Optional[StrictStr] = Field(default=None, description="URL to barcode *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg`") + __properties: ClassVar[List[str]] = ["id", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherAssetsBarcode 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherAssetsBarcode 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"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/voucher_assets_qr.py b/voucherify/models/voucher_assets_qr.py new file mode 100644 index 00000000..157bcbf5 --- /dev/null +++ b/voucherify/models/voucher_assets_qr.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherAssetsQr(BaseModel): + """ + Stores Quick Response (QR) representation of encrypted code. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Encrypted voucher code ID.") + url: Optional[StrictStr] = Field(default=None, description="URL to QR code *Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. - `size`: integer value from `1` to `100` - `format`: string, either `png` (default) or `svg`") + __properties: ClassVar[List[str]] = ["id", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherAssetsQr 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherAssetsQr 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"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/voucher_gift.py b/voucherify/models/voucher_gift.py new file mode 100644 index 00000000..a15497fb --- /dev/null +++ b/voucherify/models/voucher_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class VoucherGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/voucher_loyalty_card.py b/voucherify/models/voucher_loyalty_card.py new file mode 100644 index 00000000..144b95ed --- /dev/null +++ b/voucherify/models/voucher_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/voucher_publish.py b/voucherify/models/voucher_publish.py new file mode 100644 index 00000000..f15df872 --- /dev/null +++ b/voucherify/models/voucher_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/voucher_redemption.py b/voucherify/models/voucher_redemption.py new file mode 100644 index 00000000..3fdd7a43 --- /dev/null +++ b/voucherify/models/voucher_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction.py b/voucherify/models/voucher_transaction.py new file mode 100644 index 00000000..6f6391b3 --- /dev/null +++ b/voucherify/models/voucher_transaction.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.loyalty_card_transactions_type import LoyaltyCardTransactionsType +from voucherify.models.voucher_transaction_details import VoucherTransactionDetails +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransaction(BaseModel): + """ + VoucherTransaction + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique transaction ID.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null.") + voucher_id: Optional[StrictStr] = Field(default=None, description="Unique voucher ID.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.") + source: Optional[StrictStr] = Field(default=None, description="The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null.") + reason: Optional[StrictStr] = Field(default=None, description="Reason why the transaction occurred. In case of a redemption, this value is null.") + type: LoyaltyCardTransactionsType + details: Optional[VoucherTransactionDetails] = None + related_transaction_id: Optional[StrictStr] = Field(default=None, description="The related transaction ID on the receiving card.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the transaction was created. The value is shown in the ISO 8601 format.") + __properties: ClassVar[List[str]] = ["id", "source_id", "voucher_id", "campaign_id", "source", "reason", "type", "details", "related_transaction_id", "created_at"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransaction 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() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if voucher_id (nullable) is None + # and model_fields_set contains the field + if self.voucher_id is None and "voucher_id" in self.model_fields_set: + _dict['voucher_id'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + # set to None if details (nullable) is None + # and model_fields_set contains the field + if self.details is None and "details" in self.model_fields_set: + _dict['details'] = None + + # set to None if related_transaction_id (nullable) is None + # and model_fields_set contains the field + if self.related_transaction_id is None and "related_transaction_id" in self.model_fields_set: + _dict['related_transaction_id'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransaction 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"), + "source_id": obj.get("source_id"), + "voucher_id": obj.get("voucher_id"), + "campaign_id": obj.get("campaign_id"), + "source": obj.get("source"), + "reason": obj.get("reason"), + "type": obj.get("type"), + "details": VoucherTransactionDetails.from_dict(obj["details"]) if obj.get("details") is not None else None, + "related_transaction_id": obj.get("related_transaction_id"), + "created_at": obj.get("created_at") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details.py b/voucherify/models/voucher_transaction_details.py new file mode 100644 index 00000000..6f3b430f --- /dev/null +++ b/voucherify/models/voucher_transaction_details.py @@ -0,0 +1,218 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.simple_voucher import SimpleVoucher +from voucherify.models.voucher_transaction_details_balance import VoucherTransactionDetailsBalance +from voucherify.models.voucher_transaction_details_custom_event import VoucherTransactionDetailsCustomEvent +from voucherify.models.voucher_transaction_details_earning_rule import VoucherTransactionDetailsEarningRule +from voucherify.models.voucher_transaction_details_event import VoucherTransactionDetailsEvent +from voucherify.models.voucher_transaction_details_event_schema import VoucherTransactionDetailsEventSchema +from voucherify.models.voucher_transaction_details_loyalty_tier import VoucherTransactionDetailsLoyaltyTier +from voucherify.models.voucher_transaction_details_order import VoucherTransactionDetailsOrder +from voucherify.models.voucher_transaction_details_redemption import VoucherTransactionDetailsRedemption +from voucherify.models.voucher_transaction_details_reward import VoucherTransactionDetailsReward +from voucherify.models.voucher_transaction_details_rollback import VoucherTransactionDetailsRollback +from voucherify.models.voucher_transaction_details_segment import VoucherTransactionDetailsSegment +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetails(BaseModel): + """ + Contains the detailed information about the transaction. + """ # noqa: E501 + balance: Optional[VoucherTransactionDetailsBalance] = None + order: Optional[VoucherTransactionDetailsOrder] = None + event: Optional[VoucherTransactionDetailsEvent] = None + earning_rule: Optional[VoucherTransactionDetailsEarningRule] = None + segment: Optional[VoucherTransactionDetailsSegment] = None + loyalty_tier: Optional[VoucherTransactionDetailsLoyaltyTier] = None + redemption: Optional[VoucherTransactionDetailsRedemption] = None + rollback: Optional[VoucherTransactionDetailsRollback] = None + custom_event: Optional[VoucherTransactionDetailsCustomEvent] = None + event_schema: Optional[VoucherTransactionDetailsEventSchema] = None + reward: Optional[VoucherTransactionDetailsReward] = None + source_voucher: Optional[SimpleVoucher] = None + destination_voucher: Optional[SimpleVoucher] = None + __properties: ClassVar[List[str]] = ["balance", "order", "event", "earning_rule", "segment", "loyalty_tier", "redemption", "rollback", "custom_event", "event_schema", "reward", "source_voucher", "destination_voucher"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetails 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 balance + if self.balance: + _dict['balance'] = self.balance.to_dict() + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of event + if self.event: + _dict['event'] = self.event.to_dict() + # override the default output from pydantic by calling `to_dict()` of earning_rule + if self.earning_rule: + _dict['earning_rule'] = self.earning_rule.to_dict() + # override the default output from pydantic by calling `to_dict()` of segment + if self.segment: + _dict['segment'] = self.segment.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_tier + if self.loyalty_tier: + _dict['loyalty_tier'] = self.loyalty_tier.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of rollback + if self.rollback: + _dict['rollback'] = self.rollback.to_dict() + # override the default output from pydantic by calling `to_dict()` of custom_event + if self.custom_event: + _dict['custom_event'] = self.custom_event.to_dict() + # override the default output from pydantic by calling `to_dict()` of event_schema + if self.event_schema: + _dict['event_schema'] = self.event_schema.to_dict() + # override the default output from pydantic by calling `to_dict()` of reward + if self.reward: + _dict['reward'] = self.reward.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_voucher + if self.source_voucher: + _dict['source_voucher'] = self.source_voucher.to_dict() + # override the default output from pydantic by calling `to_dict()` of destination_voucher + if self.destination_voucher: + _dict['destination_voucher'] = self.destination_voucher.to_dict() + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if event (nullable) is None + # and model_fields_set contains the field + if self.event is None and "event" in self.model_fields_set: + _dict['event'] = None + + # set to None if earning_rule (nullable) is None + # and model_fields_set contains the field + if self.earning_rule is None and "earning_rule" in self.model_fields_set: + _dict['earning_rule'] = None + + # set to None if segment (nullable) is None + # and model_fields_set contains the field + if self.segment is None and "segment" in self.model_fields_set: + _dict['segment'] = None + + # set to None if loyalty_tier (nullable) is None + # and model_fields_set contains the field + if self.loyalty_tier is None and "loyalty_tier" in self.model_fields_set: + _dict['loyalty_tier'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if rollback (nullable) is None + # and model_fields_set contains the field + if self.rollback is None and "rollback" in self.model_fields_set: + _dict['rollback'] = None + + # set to None if custom_event (nullable) is None + # and model_fields_set contains the field + if self.custom_event is None and "custom_event" in self.model_fields_set: + _dict['custom_event'] = None + + # set to None if event_schema (nullable) is None + # and model_fields_set contains the field + if self.event_schema is None and "event_schema" in self.model_fields_set: + _dict['event_schema'] = None + + # set to None if reward (nullable) is None + # and model_fields_set contains the field + if self.reward is None and "reward" in self.model_fields_set: + _dict['reward'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "balance": VoucherTransactionDetailsBalance.from_dict(obj["balance"]) if obj.get("balance") is not None else None, + "order": VoucherTransactionDetailsOrder.from_dict(obj["order"]) if obj.get("order") is not None else None, + "event": VoucherTransactionDetailsEvent.from_dict(obj["event"]) if obj.get("event") is not None else None, + "earning_rule": VoucherTransactionDetailsEarningRule.from_dict(obj["earning_rule"]) if obj.get("earning_rule") is not None else None, + "segment": VoucherTransactionDetailsSegment.from_dict(obj["segment"]) if obj.get("segment") is not None else None, + "loyalty_tier": VoucherTransactionDetailsLoyaltyTier.from_dict(obj["loyalty_tier"]) if obj.get("loyalty_tier") is not None else None, + "redemption": VoucherTransactionDetailsRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "rollback": VoucherTransactionDetailsRollback.from_dict(obj["rollback"]) if obj.get("rollback") is not None else None, + "custom_event": VoucherTransactionDetailsCustomEvent.from_dict(obj["custom_event"]) if obj.get("custom_event") is not None else None, + "event_schema": VoucherTransactionDetailsEventSchema.from_dict(obj["event_schema"]) if obj.get("event_schema") is not None else None, + "reward": VoucherTransactionDetailsReward.from_dict(obj["reward"]) if obj.get("reward") is not None else None, + "source_voucher": SimpleVoucher.from_dict(obj["source_voucher"]) if obj.get("source_voucher") is not None else None, + "destination_voucher": SimpleVoucher.from_dict(obj["destination_voucher"]) if obj.get("destination_voucher") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_balance.py b/voucherify/models/voucher_transaction_details_balance.py new file mode 100644 index 00000000..1e97cfcb --- /dev/null +++ b/voucherify/models/voucher_transaction_details_balance.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from voucherify.models.voucher_transaction_details_balance_related_object import VoucherTransactionDetailsBalanceRelatedObject +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsBalance(BaseModel): + """ + Contains information on how the balance was affected by the transaction. + """ # noqa: E501 + type: Optional[Annotated[str, Field(strict=True)]] = Field(default='loyalty_card', description="The type of voucher whose balance is being adjusted due to the transaction.") + total: Optional[StrictInt] = Field(default=None, description="The number of all points accumulated on the card as affected by add or subtract operations.") + object: Optional[Annotated[str, Field(strict=True)]] = Field(default='balance', description="The type of the object represented by the JSON.") + points: Optional[StrictInt] = Field(default=None, description="Points added or subtracted in the transaction.") + balance: Optional[StrictInt] = Field(default=None, description="The available points on the card after the transaction as affected by redemption or rollback.") + related_object: Optional[VoucherTransactionDetailsBalanceRelatedObject] = None + __properties: ClassVar[List[str]] = ["type", "total", "object", "points", "balance", "related_object"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"loyalty_card", value): + raise ValueError(r"must validate the regular expression /loyalty_card/") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['loyalty_card']): + raise ValueError("must be one of enum values ('loyalty_card')") + return value + + @field_validator('object') + def object_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"balance", value): + raise ValueError(r"must validate the regular expression /balance/") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['balance']): + raise ValueError("must be one of enum values ('balance')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsBalance 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 related_object + if self.related_object: + _dict['related_object'] = self.related_object.to_dict() + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if related_object (nullable) is None + # and model_fields_set contains the field + if self.related_object is None and "related_object" in self.model_fields_set: + _dict['related_object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsBalance from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") if obj.get("type") is not None else 'loyalty_card', + "total": obj.get("total"), + "object": obj.get("object") if obj.get("object") is not None else 'balance', + "points": obj.get("points"), + "balance": obj.get("balance"), + "related_object": VoucherTransactionDetailsBalanceRelatedObject.from_dict(obj["related_object"]) if obj.get("related_object") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_balance_related_object.py b/voucherify/models/voucher_transaction_details_balance_related_object.py new file mode 100644 index 00000000..7a15f5b6 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_balance_related_object.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsBalanceRelatedObject(BaseModel): + """ + Defines the resource that is being modified with the values that are returned in the balance object. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.") + type: Optional[Annotated[str, Field(strict=True)]] = Field(default='voucher', description="The object being modified, i.e. voucher.") + __properties: ClassVar[List[str]] = ["id", "type"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"voucher", value): + raise ValueError(r"must validate the regular expression /voucher/") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsBalanceRelatedObject 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsBalanceRelatedObject 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"), + "type": obj.get("type") if obj.get("type") is not None else 'voucher' + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_custom_event.py b/voucherify/models/voucher_transaction_details_custom_event.py new file mode 100644 index 00000000..7e091d46 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_custom_event.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsCustomEvent(BaseModel): + """ + Contains information about the custom event that triggers the point accrual. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique event ID.") + type: Optional[StrictStr] = Field(default=None, description="Type of custom event.") + __properties: ClassVar[List[str]] = ["id", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsCustomEvent 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsCustomEvent 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"), + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_earning_rule.py b/voucherify/models/voucher_transaction_details_earning_rule.py new file mode 100644 index 00000000..a4e856e6 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_earning_rule.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.voucher_transaction_details_earning_rule_source import VoucherTransactionDetailsEarningRuleSource +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsEarningRule(BaseModel): + """ + Contains information about the earning rule. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique earning rule ID.") + source: Optional[VoucherTransactionDetailsEarningRuleSource] = None + __properties: ClassVar[List[str]] = ["id", "source"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEarningRule 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 source + if self.source: + _dict['source'] = self.source.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source (nullable) is None + # and model_fields_set contains the field + if self.source is None and "source" in self.model_fields_set: + _dict['source'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEarningRule 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"), + "source": VoucherTransactionDetailsEarningRuleSource.from_dict(obj["source"]) if obj.get("source") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_earning_rule_source.py b/voucherify/models/voucher_transaction_details_earning_rule_source.py new file mode 100644 index 00000000..f5111d7f --- /dev/null +++ b/voucherify/models/voucher_transaction_details_earning_rule_source.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsEarningRuleSource(BaseModel): + """ + Contains the custom earning rule name. + """ # noqa: E501 + banner: Optional[StrictStr] = Field(default=None, description="Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.") + __properties: ClassVar[List[str]] = ["banner"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEarningRuleSource 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, + ) + # set to None if banner (nullable) is None + # and model_fields_set contains the field + if self.banner is None and "banner" in self.model_fields_set: + _dict['banner'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEarningRuleSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "banner": obj.get("banner") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_event.py b/voucherify/models/voucher_transaction_details_event.py new file mode 100644 index 00000000..a784a628 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_event.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsEvent(BaseModel): + """ + Contains information about the event that triggers the point accrual. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique event ID.") + type: Optional[StrictStr] = Field(default=None, description="Type of event.") + __properties: ClassVar[List[str]] = ["id", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEvent 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEvent 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"), + "type": obj.get("type") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_event_schema.py b/voucherify/models/voucher_transaction_details_event_schema.py new file mode 100644 index 00000000..2a786afa --- /dev/null +++ b/voucherify/models/voucher_transaction_details_event_schema.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsEventSchema(BaseModel): + """ + Contains information about the custom event metadata schema. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique metadata schema ID.") + name: Optional[StrictStr] = Field(default=None, description="Type of custom event.") + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEventSchema 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsEventSchema 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_loyalty_tier.py b/voucherify/models/voucher_transaction_details_loyalty_tier.py new file mode 100644 index 00000000..089b19ce --- /dev/null +++ b/voucherify/models/voucher_transaction_details_loyalty_tier.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsLoyaltyTier(BaseModel): + """ + Contains information about the loyalty tier. + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsLoyaltyTier 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsLoyaltyTier 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_order.py b/voucherify/models/voucher_transaction_details_order.py new file mode 100644 index 00000000..8c7ad359 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_order.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsOrder(BaseModel): + """ + Contains information about the original order. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique order ID.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service.") + __properties: ClassVar[List[str]] = ["id", "source_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsOrder 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsOrder 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"), + "source_id": obj.get("source_id") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_redemption.py b/voucherify/models/voucher_transaction_details_redemption.py new file mode 100644 index 00000000..bab7f3df --- /dev/null +++ b/voucherify/models/voucher_transaction_details_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsRedemption(BaseModel): + """ + Contains information about the original redemption. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption ID.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsRedemption 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsRedemption 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") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_reward.py b/voucherify/models/voucher_transaction_details_reward.py new file mode 100644 index 00000000..1f2bf182 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_reward.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsReward(BaseModel): + """ + Contains information about the pay with points reward. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique reward ID.") + name: Optional[StrictStr] = Field(default=None, description="Reward name.") + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsReward 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsReward 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_rollback.py b/voucherify/models/voucher_transaction_details_rollback.py new file mode 100644 index 00000000..2832dd64 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_rollback.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsRollback(BaseModel): + """ + Contains information about the redemption rollback. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique redemption rollback ID.") + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsRollback 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsRollback 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") + }) + return _obj + + diff --git a/voucherify/models/voucher_transaction_details_segment.py b/voucherify/models/voucher_transaction_details_segment.py new file mode 100644 index 00000000..2719ce33 --- /dev/null +++ b/voucherify/models/voucher_transaction_details_segment.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionDetailsSegment(BaseModel): + """ + Contains information about the segment. + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsSegment 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, + ) + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionDetailsSegment 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"), + "name": obj.get("name") + }) + return _obj + + diff --git a/voucherify/models/voucher_transactions_export_filter_conditions.py b/voucherify/models/voucher_transactions_export_filter_conditions.py new file mode 100644 index 00000000..1dd2a00b --- /dev/null +++ b/voucherify/models/voucher_transactions_export_filter_conditions.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.voucher_transactions_export_filter_conditions_voucher_id import VoucherTransactionsExportFilterConditionsVoucherId +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionsExportFilterConditions(BaseModel): + """ + Filter condition. + """ # noqa: E501 + voucher_id: Optional[VoucherTransactionsExportFilterConditionsVoucherId] = None + __properties: ClassVar[List[str]] = ["voucher_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportFilterConditions 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 voucher_id + if self.voucher_id: + _dict['voucher_id'] = self.voucher_id.to_dict() + # set to None if voucher_id (nullable) is None + # and model_fields_set contains the field + if self.voucher_id is None and "voucher_id" in self.model_fields_set: + _dict['voucher_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportFilterConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "voucher_id": VoucherTransactionsExportFilterConditionsVoucherId.from_dict(obj["voucher_id"]) if obj.get("voucher_id") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_transactions_export_filter_conditions_voucher_id.py b/voucherify/models/voucher_transactions_export_filter_conditions_voucher_id.py new file mode 100644 index 00000000..9e930e79 --- /dev/null +++ b/voucherify/models/voucher_transactions_export_filter_conditions_voucher_id.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.voucher_transactions_export_filter_conditions_voucher_id_conditions import VoucherTransactionsExportFilterConditionsVoucherIdConditions +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionsExportFilterConditionsVoucherId(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + conditions: Optional[VoucherTransactionsExportFilterConditionsVoucherIdConditions] = None + __properties: ClassVar[List[str]] = ["conditions"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportFilterConditionsVoucherId 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 conditions + if self.conditions: + _dict['conditions'] = self.conditions.to_dict() + # set to None if conditions (nullable) is None + # and model_fields_set contains the field + if self.conditions is None and "conditions" in self.model_fields_set: + _dict['conditions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportFilterConditionsVoucherId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": VoucherTransactionsExportFilterConditionsVoucherIdConditions.from_dict(obj["conditions"]) if obj.get("conditions") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_transactions_export_filter_conditions_voucher_id_conditions.py b/voucherify/models/voucher_transactions_export_filter_conditions_voucher_id_conditions.py new file mode 100644 index 00000000..95b61251 --- /dev/null +++ b/voucherify/models/voucher_transactions_export_filter_conditions_voucher_id_conditions.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionsExportFilterConditionsVoucherIdConditions(BaseModel): + """ + Data filters used to narrow down the data records to be returned in the result. + """ # noqa: E501 + var_in: Optional[Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=1)]], Field(min_length=1, max_length=1)]] = Field(default=None, alias="$in") + __properties: ClassVar[List[str]] = ["$in"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportFilterConditionsVoucherIdConditions 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, + ) + # set to None if var_in (nullable) is None + # and model_fields_set contains the field + if self.var_in is None and "var_in" in self.model_fields_set: + _dict['$in'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportFilterConditionsVoucherIdConditions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "$in": obj.get("$in") + }) + return _obj + + diff --git a/voucherify/models/voucher_transactions_export_parameters.py b/voucherify/models/voucher_transactions_export_parameters.py new file mode 100644 index 00000000..15308c8f --- /dev/null +++ b/voucherify/models/voucher_transactions_export_parameters.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class VoucherTransactionsExportParameters(BaseModel): + """ + List of available fields and filters that can be exported with a gift card or loyalty card transactions export along with the sorting order of the returned data. + """ # noqa: E501 + order: Optional[StrictStr] = Field(default=None, description="How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.") + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |") + __properties: ClassVar[List[str]] = ["order", "fields"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['-created_at', 'created_at']): + raise ValueError("must be one of enum values ('-created_at', 'created_at')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['id', 'type', 'source_id', 'reason', 'balance', 'amount', 'created_at', 'voucher_id', 'campaign_id', 'source', 'details', 'related_transaction_id']): + raise ValueError("each list item must be one of ('id', 'type', 'source_id', 'reason', 'balance', 'amount', 'created_at', 'voucher_id', 'campaign_id', 'source', 'details', 'related_transaction_id')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportParameters 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, + ) + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionsExportParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields") + }) + return _obj + + diff --git a/voucherify/models/voucher_transactions_filters.py b/voucherify/models/voucher_transactions_filters.py new file mode 100644 index 00000000..1de1728d --- /dev/null +++ b/voucherify/models/voucher_transactions_filters.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.voucher_transactions_export_filter_conditions import VoucherTransactionsExportFilterConditions +from typing import Optional, Set +from typing_extensions import Self + +class VoucherTransactionsFilters(BaseModel): + """ + List of available fields and filters that can be exported with gift card or loyalty card transactions along with the sorting order of the returned data. + """ # noqa: E501 + order: Optional[StrictStr] = Field(default=None, description="How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.") + fields: Optional[List[StrictStr]] = Field(default=None, description="Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: | **Field** | **Definition** | **Example Export** | |:---|:---|:---| | id | Unique transaction ID. | vtx_0cb7811f1c07765800 | | type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION`
- `POINTS_ACCRUAL`
- `POINTS_REDEMPTION`
- `POINTS_REFUND`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_EXPIRATION`
- `POINTS_TRANSFER_IN`
- `POINTS_TRANSFER_OUT` | | source_id | Unique transaction source ID. | 8638 | | reason | Contains the reason for the transaction if one was included originally. | | | balance | The gift card or loyalty card balance after the transaction. | | | amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | | | created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z | | voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp | | campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV | | source| Channel through which the transaction was initiated. | API | | details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. | | related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |") + filters: VoucherTransactionsExportFilterConditions + __properties: ClassVar[List[str]] = ["order", "fields", "filters"] + + @field_validator('order') + def order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['-created_at', 'created_at']): + raise ValueError("must be one of enum values ('-created_at', 'created_at')") + return value + + @field_validator('fields') + def fields_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['id', 'type', 'source_id', 'reason', 'balance', 'amount', 'created_at', 'voucher_id', 'campaign_id', 'source', 'details', 'related_transaction_id']): + raise ValueError("each list item must be one of ('id', 'type', 'source_id', 'reason', 'balance', 'amount', 'created_at', 'voucher_id', 'campaign_id', 'source', 'details', 'related_transaction_id')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherTransactionsFilters 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 filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + # set to None if order (nullable) is None + # and model_fields_set contains the field + if self.order is None and "order" in self.model_fields_set: + _dict['order'] = None + + # set to None if fields (nullable) is None + # and model_fields_set contains the field + if self.fields is None and "fields" in self.model_fields_set: + _dict['fields'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherTransactionsFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order": obj.get("order"), + "fields": obj.get("fields"), + "filters": VoucherTransactionsExportFilterConditions.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_with_categories.py b/voucherify/models/voucher_with_categories.py new file mode 100644 index 00000000..40f40f46 --- /dev/null +++ b/voucherify/models/voucher_with_categories.py @@ -0,0 +1,319 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.voucher_with_categories_gift import VoucherWithCategoriesGift +from voucherify.models.voucher_with_categories_loyalty_card import VoucherWithCategoriesLoyaltyCard +from voucherify.models.voucher_with_categories_publish import VoucherWithCategoriesPublish +from voucherify.models.voucher_with_categories_redemption import VoucherWithCategoriesRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VoucherWithCategories(BaseModel): + """ + This is an object representing a voucher with categories. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[VoucherWithCategoriesGift] = None + loyalty_card: Optional[VoucherWithCategoriesLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[VoucherWithCategoriesPublish] = None + redemption: Optional[VoucherWithCategoriesRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherWithCategories 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherWithCategories 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": VoucherWithCategoriesGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": VoucherWithCategoriesLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": VoucherWithCategoriesPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": VoucherWithCategoriesRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/voucherify/models/voucher_with_categories_gift.py b/voucherify/models/voucher_with_categories_gift.py new file mode 100644 index 00000000..6a723ad9 --- /dev/null +++ b/voucherify/models/voucher_with_categories_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class VoucherWithCategoriesGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/voucher_with_categories_loyalty_card.py b/voucherify/models/voucher_with_categories_loyalty_card.py new file mode 100644 index 00000000..f3186008 --- /dev/null +++ b/voucherify/models/voucher_with_categories_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherWithCategoriesLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/voucher_with_categories_publish.py b/voucherify/models/voucher_with_categories_publish.py new file mode 100644 index 00000000..045adb8e --- /dev/null +++ b/voucherify/models/voucher_with_categories_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherWithCategoriesPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/voucher_with_categories_redemption.py b/voucherify/models/voucher_with_categories_redemption.py new file mode 100644 index 00000000..d7a1e8fb --- /dev/null +++ b/voucherify/models/voucher_with_categories_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VoucherWithCategoriesRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VoucherWithCategoriesRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_balance_update_request_body.py b/voucherify/models/vouchers_balance_update_request_body.py new file mode 100644 index 00000000..d1e63a83 --- /dev/null +++ b/voucherify/models/vouchers_balance_update_request_body.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersBalanceUpdateRequestBody(BaseModel): + """ + Request body schema for `vouchers/{code}/balance`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="The incremental amount to be added to or removed from the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000. To remove balance, simply add a minus sign before the value, i.e. to remove $20, use -2000.") + source_id: Optional[StrictStr] = Field(default=None, description="The merchant's transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service.") + reason: Optional[StrictStr] = Field(default=None, description="Reason why the transaction occurred.") + __properties: ClassVar[List[str]] = ["amount", "source_id", "reason"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersBalanceUpdateRequestBody 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if source_id (nullable) is None + # and model_fields_set contains the field + if self.source_id is None and "source_id" in self.model_fields_set: + _dict['source_id'] = None + + # set to None if reason (nullable) is None + # and model_fields_set contains the field + if self.reason is None and "reason" in self.model_fields_set: + _dict['reason'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersBalanceUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "source_id": obj.get("source_id"), + "reason": obj.get("reason") + }) + return _obj + + diff --git a/voucherify/models/vouchers_balance_update_response_body.py b/voucherify/models/vouchers_balance_update_response_body.py new file mode 100644 index 00000000..7e7d5ac1 --- /dev/null +++ b/voucherify/models/vouchers_balance_update_response_body.py @@ -0,0 +1,169 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.vouchers_balance_update_response_body_related_object import VouchersBalanceUpdateResponseBodyRelatedObject +from typing import Optional, Set +from typing_extensions import Self + +class VouchersBalanceUpdateResponseBody(BaseModel): + """ + Response body schema for `vouchers/{code}/balance.` + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="The incremental amount added (positive integer) or subtracted (negative integer) to the current balance on the gift card or loyalty card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + total: Optional[StrictInt] = Field(default=None, description="Total income incurred over the lifespan of the gift card or loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="The balance after adding or subtracting a specified amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + type: Optional[StrictStr] = Field(default=None, description="The type of voucher being modified.") + operation_type: Optional[StrictStr] = 'MANUAL' + object: Optional[StrictStr] = Field(default='balance', description="The type of the object represented by JSON. Default is `balance`.") + related_object: Optional[VouchersBalanceUpdateResponseBodyRelatedObject] = None + __properties: ClassVar[List[str]] = ["amount", "total", "balance", "type", "operation_type", "object", "related_object"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['gift_voucher', 'loyalty_card']): + raise ValueError("must be one of enum values ('gift_voucher', 'loyalty_card')") + return value + + @field_validator('operation_type') + def operation_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['MANUAL']): + raise ValueError("must be one of enum values ('MANUAL')") + return value + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['balance']): + raise ValueError("must be one of enum values ('balance')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersBalanceUpdateResponseBody 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 related_object + if self.related_object: + _dict['related_object'] = self.related_object.to_dict() + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if operation_type (nullable) is None + # and model_fields_set contains the field + if self.operation_type is None and "operation_type" in self.model_fields_set: + _dict['operation_type'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if related_object (nullable) is None + # and model_fields_set contains the field + if self.related_object is None and "related_object" in self.model_fields_set: + _dict['related_object'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersBalanceUpdateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "total": obj.get("total"), + "balance": obj.get("balance"), + "type": obj.get("type"), + "operation_type": obj.get("operation_type") if obj.get("operation_type") is not None else 'MANUAL', + "object": obj.get("object") if obj.get("object") is not None else 'balance', + "related_object": VouchersBalanceUpdateResponseBodyRelatedObject.from_dict(obj["related_object"]) if obj.get("related_object") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_balance_update_response_body_related_object.py b/voucherify/models/vouchers_balance_update_response_body_related_object.py new file mode 100644 index 00000000..9a80fa4d --- /dev/null +++ b/voucherify/models/vouchers_balance_update_response_body_related_object.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 import Optional, Set +from typing_extensions import Self + +class VouchersBalanceUpdateResponseBodyRelatedObject(BaseModel): + """ + Defines the resource that is being modified with the values that are returned in the balance object. + """ # noqa: E501 + type: Optional[StrictStr] = Field(default='voucher', description="The object being modified, i.e. `voucher`.") + id: Optional[StrictStr] = Field(default=None, description="Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.") + __properties: ClassVar[List[str]] = ["type", "id"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher']): + raise ValueError("must be one of enum values ('voucher')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersBalanceUpdateResponseBodyRelatedObject 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, + ) + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersBalanceUpdateResponseBodyRelatedObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") if obj.get("type") is not None else 'voucher', + "id": obj.get("id") + }) + return _obj + + diff --git a/voucherify/models/vouchers_create_response_body.py b/voucherify/models/vouchers_create_response_body.py new file mode 100644 index 00000000..01f75128 --- /dev/null +++ b/voucherify/models/vouchers_create_response_body.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.vouchers_create_response_body_gift import VouchersCreateResponseBodyGift +from voucherify.models.vouchers_create_response_body_loyalty_card import VouchersCreateResponseBodyLoyaltyCard +from voucherify.models.vouchers_create_response_body_publish import VouchersCreateResponseBodyPublish +from voucherify.models.vouchers_create_response_body_redemption import VouchersCreateResponseBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VouchersCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers` and `/vouchers/{code}` + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[VouchersCreateResponseBodyGift] = None + loyalty_card: Optional[VouchersCreateResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[VouchersCreateResponseBodyPublish] = None + redemption: Optional[VouchersCreateResponseBodyRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBody 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": VouchersCreateResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": VouchersCreateResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": VouchersCreateResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": VouchersCreateResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_create_response_body_gift.py b/voucherify/models/vouchers_create_response_body_gift.py new file mode 100644 index 00000000..acc55578 --- /dev/null +++ b/voucherify/models/vouchers_create_response_body_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class VouchersCreateResponseBodyGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/vouchers_create_response_body_loyalty_card.py b/voucherify/models/vouchers_create_response_body_loyalty_card.py new file mode 100644 index 00000000..9c3c146c --- /dev/null +++ b/voucherify/models/vouchers_create_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersCreateResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/vouchers_create_response_body_publish.py b/voucherify/models/vouchers_create_response_body_publish.py new file mode 100644 index 00000000..8f0af1ad --- /dev/null +++ b/voucherify/models/vouchers_create_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersCreateResponseBodyPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_create_response_body_redemption.py b/voucherify/models/vouchers_create_response_body_redemption.py new file mode 100644 index 00000000..eb01e7ef --- /dev/null +++ b/voucherify/models/vouchers_create_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersCreateResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersCreateResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_create_with_specific_code_request_body.py b/voucherify/models/vouchers_create_with_specific_code_request_body.py new file mode 100644 index 00000000..cb18071a --- /dev/null +++ b/voucherify/models/vouchers_create_with_specific_code_request_body.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from voucherify.models.simple_loyalty_card import SimpleLoyaltyCard +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.vouchers_create_with_specific_code_request_body_redemption import VouchersCreateWithSpecificCodeRequestBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VouchersCreateWithSpecificCodeRequestBody(BaseModel): + """ + VouchersCreateWithSpecificCodeRequestBody + """ # noqa: E501 + campaign: Optional[StrictStr] = Field(default=None, description="Identifies the voucher's parent campaign using a unique campaign name.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Identifies the voucher's parent campaign using a unique campaign ID assigned by the Voucherify API.") + category: Optional[StrictStr] = Field(default=None, description="The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint.") + start_date: Optional[datetime] = Field(default=None, description="Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date.") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = None + validation_rules: Optional[List[StrictStr]] = Field(default=None, description="Array containing the ID of the validation rule associated with the voucher.") + redemption: Optional[VouchersCreateWithSpecificCodeRequestBodyRedemption] = None + type: Optional[StrictStr] = None + loyalty_card: Optional[SimpleLoyaltyCard] = None + gift: Optional[Gift] = None + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["campaign", "campaign_id", "category", "category_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "validation_rules", "redemption", "type", "loyalty_card", "gift", "discount"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD', 'GIFT_VOUCHER', 'DISCOUNT_VOUCHER']): + raise ValueError("must be one of enum values ('LOYALTY_CARD', 'GIFT_VOUCHER', 'DISCOUNT_VOUCHER')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersCreateWithSpecificCodeRequestBody 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if validation_rules (nullable) is None + # and model_fields_set contains the field + if self.validation_rules is None and "validation_rules" in self.model_fields_set: + _dict['validation_rules'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersCreateWithSpecificCodeRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "validation_rules": obj.get("validation_rules"), + "redemption": VouchersCreateWithSpecificCodeRequestBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "type": obj.get("type"), + "loyalty_card": SimpleLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_create_with_specific_code_request_body_redemption.py b/voucherify/models/vouchers_create_with_specific_code_request_body_redemption.py new file mode 100644 index 00000000..85b9bbbb --- /dev/null +++ b/voucherify/models/vouchers_create_with_specific_code_request_body_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersCreateWithSpecificCodeRequestBodyRedemption(BaseModel): + """ + VouchersCreateWithSpecificCodeRequestBodyRedemption + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersCreateWithSpecificCodeRequestBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersCreateWithSpecificCodeRequestBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/vouchers_disable_response_body.py b/voucherify/models/vouchers_disable_response_body.py new file mode 100644 index 00000000..e3474032 --- /dev/null +++ b/voucherify/models/vouchers_disable_response_body.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.vouchers_disable_response_body_gift import VouchersDisableResponseBodyGift +from voucherify.models.vouchers_disable_response_body_loyalty_card import VouchersDisableResponseBodyLoyaltyCard +from voucherify.models.vouchers_disable_response_body_publish import VouchersDisableResponseBodyPublish +from voucherify.models.vouchers_disable_response_body_redemption import VouchersDisableResponseBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VouchersDisableResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers/{code}/disable`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[VouchersDisableResponseBodyGift] = None + loyalty_card: Optional[VouchersDisableResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[VouchersDisableResponseBodyPublish] = None + redemption: Optional[VouchersDisableResponseBodyRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBody 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": VouchersDisableResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": VouchersDisableResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": VouchersDisableResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": VouchersDisableResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_disable_response_body_gift.py b/voucherify/models/vouchers_disable_response_body_gift.py new file mode 100644 index 00000000..a4f9c572 --- /dev/null +++ b/voucherify/models/vouchers_disable_response_body_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class VouchersDisableResponseBodyGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/vouchers_disable_response_body_loyalty_card.py b/voucherify/models/vouchers_disable_response_body_loyalty_card.py new file mode 100644 index 00000000..b6f75c7d --- /dev/null +++ b/voucherify/models/vouchers_disable_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersDisableResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/vouchers_disable_response_body_publish.py b/voucherify/models/vouchers_disable_response_body_publish.py new file mode 100644 index 00000000..3b0eb286 --- /dev/null +++ b/voucherify/models/vouchers_disable_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersDisableResponseBodyPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_disable_response_body_redemption.py b/voucherify/models/vouchers_disable_response_body_redemption.py new file mode 100644 index 00000000..e55e3a83 --- /dev/null +++ b/voucherify/models/vouchers_disable_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersDisableResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersDisableResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_enable_response_body.py b/voucherify/models/vouchers_enable_response_body.py new file mode 100644 index 00000000..11a72db2 --- /dev/null +++ b/voucherify/models/vouchers_enable_response_body.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.vouchers_enable_response_body_gift import VouchersEnableResponseBodyGift +from voucherify.models.vouchers_enable_response_body_loyalty_card import VouchersEnableResponseBodyLoyaltyCard +from voucherify.models.vouchers_enable_response_body_publish import VouchersEnableResponseBodyPublish +from voucherify.models.vouchers_enable_response_body_redemption import VouchersEnableResponseBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VouchersEnableResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers/{code}/enable`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[VouchersEnableResponseBodyGift] = None + loyalty_card: Optional[VouchersEnableResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[VouchersEnableResponseBodyPublish] = None + redemption: Optional[VouchersEnableResponseBodyRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBody 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": VouchersEnableResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": VouchersEnableResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": VouchersEnableResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": VouchersEnableResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_enable_response_body_gift.py b/voucherify/models/vouchers_enable_response_body_gift.py new file mode 100644 index 00000000..b8fa093f --- /dev/null +++ b/voucherify/models/vouchers_enable_response_body_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class VouchersEnableResponseBodyGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/vouchers_enable_response_body_loyalty_card.py b/voucherify/models/vouchers_enable_response_body_loyalty_card.py new file mode 100644 index 00000000..f9ef06d1 --- /dev/null +++ b/voucherify/models/vouchers_enable_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersEnableResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/vouchers_enable_response_body_publish.py b/voucherify/models/vouchers_enable_response_body_publish.py new file mode 100644 index 00000000..b16d4e64 --- /dev/null +++ b/voucherify/models/vouchers_enable_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersEnableResponseBodyPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_enable_response_body_redemption.py b/voucherify/models/vouchers_enable_response_body_redemption.py new file mode 100644 index 00000000..a9156cca --- /dev/null +++ b/voucherify/models/vouchers_enable_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersEnableResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersEnableResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_get_response_body.py b/voucherify/models/vouchers_get_response_body.py new file mode 100644 index 00000000..91e6f974 --- /dev/null +++ b/voucherify/models/vouchers_get_response_body.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.vouchers_get_response_body_gift import VouchersGetResponseBodyGift +from voucherify.models.vouchers_get_response_body_loyalty_card import VouchersGetResponseBodyLoyaltyCard +from voucherify.models.vouchers_get_response_body_publish import VouchersGetResponseBodyPublish +from voucherify.models.vouchers_get_response_body_redemption import VouchersGetResponseBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VouchersGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/vouchers/{code}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[VouchersGetResponseBodyGift] = None + loyalty_card: Optional[VouchersGetResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[VouchersGetResponseBodyPublish] = None + redemption: Optional[VouchersGetResponseBodyRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersGetResponseBody 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersGetResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": VouchersGetResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": VouchersGetResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": VouchersGetResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": VouchersGetResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_get_response_body_gift.py b/voucherify/models/vouchers_get_response_body_gift.py new file mode 100644 index 00000000..7b2c9579 --- /dev/null +++ b/voucherify/models/vouchers_get_response_body_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class VouchersGetResponseBodyGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/vouchers_get_response_body_loyalty_card.py b/voucherify/models/vouchers_get_response_body_loyalty_card.py new file mode 100644 index 00000000..1a0692ad --- /dev/null +++ b/voucherify/models/vouchers_get_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersGetResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/vouchers_get_response_body_publish.py b/voucherify/models/vouchers_get_response_body_publish.py new file mode 100644 index 00000000..d271636a --- /dev/null +++ b/voucherify/models/vouchers_get_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersGetResponseBodyPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_get_response_body_redemption.py b/voucherify/models/vouchers_get_response_body_redemption.py new file mode 100644 index 00000000..1f071fae --- /dev/null +++ b/voucherify/models/vouchers_get_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersGetResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersGetResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_import_create_item_request_body.py b/voucherify/models/vouchers_import_create_item_request_body.py new file mode 100644 index 00000000..1689d855 --- /dev/null +++ b/voucherify/models/vouchers_import_create_item_request_body.py @@ -0,0 +1,195 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.vouchers_import_create_item_request_body_redemption import VouchersImportCreateItemRequestBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VouchersImportCreateItemRequestBody(BaseModel): + """ + VouchersImportCreateItemRequestBody + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Value representing the imported code.") + redemption: Optional[VouchersImportCreateItemRequestBodyRedemption] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + metadata: Optional[Dict[str, Any]] = None + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint.") + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp presented in the ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date. Allowed date formats are: - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + type: Optional[StrictStr] = None + gift: Optional[Gift] = None + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["code", "redemption", "active", "metadata", "category", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "additional_info", "type", "gift", "discount"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersImportCreateItemRequestBody 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 redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersImportCreateItemRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "redemption": VouchersImportCreateItemRequestBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "active": obj.get("active"), + "metadata": obj.get("metadata"), + "category": obj.get("category"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "additional_info": obj.get("additional_info"), + "type": obj.get("type"), + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_import_create_item_request_body_redemption.py b/voucherify/models/vouchers_import_create_item_request_body_redemption.py new file mode 100644 index 00000000..cbda31e9 --- /dev/null +++ b/voucherify/models/vouchers_import_create_item_request_body_redemption.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersImportCreateItemRequestBodyRedemption(BaseModel): + """ + VouchersImportCreateItemRequestBodyRedemption + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + __properties: ClassVar[List[str]] = ["quantity"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersImportCreateItemRequestBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersImportCreateItemRequestBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity") + }) + return _obj + + diff --git a/voucherify/models/vouchers_import_create_response_body.py b/voucherify/models/vouchers_import_create_response_body.py new file mode 100644 index 00000000..0e69c036 --- /dev/null +++ b/voucherify/models/vouchers_import_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersImportCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers/import`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersImportCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersImportCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/vouchers_import_csv_create_response_body.py b/voucherify/models/vouchers_import_csv_create_response_body.py new file mode 100644 index 00000000..857ce5ea --- /dev/null +++ b/voucherify/models/vouchers_import_csv_create_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersImportCsvCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers/importCSV`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersImportCsvCreateResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersImportCsvCreateResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/vouchers_list_response_body.py b/voucherify/models/vouchers_list_response_body.py new file mode 100644 index 00000000..520118e7 --- /dev/null +++ b/voucherify/models/vouchers_list_response_body.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 voucherify.models.voucher_with_categories import VoucherWithCategories +from typing import Optional, Set +from typing_extensions import Self + +class VouchersListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/vouchers`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON.") + data_ref: Optional[StrictStr] = Field(default='vouchers', description="Identifies the name of the attribute that contains the array of voucher objects.") + vouchers: Optional[List[VoucherWithCategories]] = Field(default=None, description="A dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object.") + total: Optional[StrictInt] = Field(default=None, description="Returns how many vouchers in the project meet the limits defined by the query parameter definitions.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "vouchers", "total"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['vouchers']): + raise ValueError("must be one of enum values ('vouchers')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersListResponseBody 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 vouchers (list) + _items = [] + if self.vouchers: + for _item_vouchers in self.vouchers: + if _item_vouchers: + _items.append(_item_vouchers.to_dict()) + _dict['vouchers'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if vouchers (nullable) is None + # and model_fields_set contains the field + if self.vouchers is None and "vouchers" in self.model_fields_set: + _dict['vouchers'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'vouchers', + "vouchers": [VoucherWithCategories.from_dict(_item) for _item in obj["vouchers"]] if obj.get("vouchers") is not None else None, + "total": obj.get("total") + }) + return _obj + + diff --git a/voucherify/models/vouchers_metadata_update_in_bulk_request_body.py b/voucherify/models/vouchers_metadata_update_in_bulk_request_body.py new file mode 100644 index 00000000..0e01ad72 --- /dev/null +++ b/voucherify/models/vouchers_metadata_update_in_bulk_request_body.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersMetadataUpdateInBulkRequestBody(BaseModel): + """ + Request body schema for `vouchers/metadata/async`. + """ # noqa: E501 + codes: Optional[List[StrictStr]] = Field(default=None, description="An array of voucher codes.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + __properties: ClassVar[List[str]] = ["codes", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersMetadataUpdateInBulkRequestBody 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, + ) + # set to None if codes (nullable) is None + # and model_fields_set contains the field + if self.codes is None and "codes" in self.model_fields_set: + _dict['codes'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersMetadataUpdateInBulkRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "codes": obj.get("codes"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/vouchers_metadata_update_in_bulk_response_body.py b/voucherify/models/vouchers_metadata_update_in_bulk_response_body.py new file mode 100644 index 00000000..1574f7bc --- /dev/null +++ b/voucherify/models/vouchers_metadata_update_in_bulk_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersMetadataUpdateInBulkResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers/metadata/async`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersMetadataUpdateInBulkResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersMetadataUpdateInBulkResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/vouchers_redemption_get_response_body.py b/voucherify/models/vouchers_redemption_get_response_body.py new file mode 100644 index 00000000..9e4026f5 --- /dev/null +++ b/voucherify/models/vouchers_redemption_get_response_body.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.redemption_entry import RedemptionEntry +from typing import Optional, Set +from typing_extensions import Self + +class VouchersRedemptionGetResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/vouchers/{code}/redemption`. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="The maximum number of times a voucher can be redeemed.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="The number of times the voucher was redeemed successfully.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON. This object stores information about redemptions in a dictionary.") + url: Optional[StrictStr] = Field(default=None, description="URL") + data_ref: Optional[StrictStr] = Field(default='redemption_entries', description="Identifies the name of the attribute that contains the array of `redemption_entries`.") + total: Optional[StrictInt] = Field(default=None, description="Total number of redemption objects.") + redemption_entries: List[RedemptionEntry] = Field(description="Contains the array of successful and failed redemption objects.") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "object", "url", "data_ref", "total", "redemption_entries"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersRedemptionGetResponseBody 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 redemption_entries (list) + _items = [] + if self.redemption_entries: + for _item_redemption_entries in self.redemption_entries: + if _item_redemption_entries: + _items.append(_item_redemption_entries.to_dict()) + _dict['redemption_entries'] = _items + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if total (nullable) is None + # and model_fields_set contains the field + if self.total is None and "total" in self.model_fields_set: + _dict['total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersRedemptionGetResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url"), + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'redemption_entries', + "total": obj.get("total"), + "redemption_entries": [RedemptionEntry.from_dict(_item) for _item in obj["redemption_entries"]] if obj.get("redemption_entries") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_transactions_export_create_request_body.py b/voucherify/models/vouchers_transactions_export_create_request_body.py new file mode 100644 index 00000000..3c87cdf7 --- /dev/null +++ b/voucherify/models/vouchers_transactions_export_create_request_body.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.voucher_transactions_export_parameters import VoucherTransactionsExportParameters +from typing import Optional, Set +from typing_extensions import Self + +class VouchersTransactionsExportCreateRequestBody(BaseModel): + """ + Request body schema for **POST** `v1/vouchers/transactions/export`. + """ # noqa: E501 + parameters: Optional[VoucherTransactionsExportParameters] = None + __properties: ClassVar[List[str]] = ["parameters"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersTransactionsExportCreateRequestBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersTransactionsExportCreateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "parameters": VoucherTransactionsExportParameters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_transactions_export_create_response_body.py b/voucherify/models/vouchers_transactions_export_create_response_body.py new file mode 100644 index 00000000..adbfbf8e --- /dev/null +++ b/voucherify/models/vouchers_transactions_export_create_response_body.py @@ -0,0 +1,183 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.voucher_transactions_filters import VoucherTransactionsFilters +from voucherify.models.vouchers_transactions_export_create_response_body_result import VouchersTransactionsExportCreateResponseBodyResult +from typing import Optional, Set +from typing_extensions import Self + +class VouchersTransactionsExportCreateResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers/{code}/transactions/export`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique export ID.") + object: Optional[StrictStr] = Field(default='export', description="The type of object being represented. This object stores information about the `export`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the export was scheduled in ISO 8601 format.") + status: Optional[StrictStr] = Field(default='SCHEDULED', description="Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.") + channel: Optional[StrictStr] = Field(default='API', description="The channel through which the export was triggered.") + exported_object: Optional[StrictStr] = Field(default='voucher_transactions', description="The type of exported object.") + parameters: VoucherTransactionsFilters + result: Optional[VouchersTransactionsExportCreateResponseBodyResult] = None + user_id: Optional[StrictStr] = Field(default=None, description="Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.") + __properties: ClassVar[List[str]] = ["id", "object", "created_at", "status", "channel", "exported_object", "parameters", "result", "user_id"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['export']): + raise ValueError("must be one of enum values ('export')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SCHEDULED']): + raise ValueError("must be one of enum values ('SCHEDULED')") + return value + + @field_validator('exported_object') + def exported_object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['voucher_transactions']): + raise ValueError("must be one of enum values ('voucher_transactions')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersTransactionsExportCreateResponseBody 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 parameters + if self.parameters: + _dict['parameters'] = self.parameters.to_dict() + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if status (nullable) is None + # and model_fields_set contains the field + if self.status is None and "status" in self.model_fields_set: + _dict['status'] = None + + # set to None if channel (nullable) is None + # and model_fields_set contains the field + if self.channel is None and "channel" in self.model_fields_set: + _dict['channel'] = None + + # set to None if exported_object (nullable) is None + # and model_fields_set contains the field + if self.exported_object is None and "exported_object" in self.model_fields_set: + _dict['exported_object'] = None + + # set to None if result (nullable) is None + # and model_fields_set contains the field + if self.result is None and "result" in self.model_fields_set: + _dict['result'] = None + + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersTransactionsExportCreateResponseBody 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"), + "object": obj.get("object") if obj.get("object") is not None else 'export', + "created_at": obj.get("created_at"), + "status": obj.get("status") if obj.get("status") is not None else 'SCHEDULED', + "channel": obj.get("channel") if obj.get("channel") is not None else 'API', + "exported_object": obj.get("exported_object") if obj.get("exported_object") is not None else 'voucher_transactions', + "parameters": VoucherTransactionsFilters.from_dict(obj["parameters"]) if obj.get("parameters") is not None else None, + "result": VouchersTransactionsExportCreateResponseBodyResult.from_dict(obj["result"]) if obj.get("result") is not None else None, + "user_id": obj.get("user_id") + }) + return _obj + + diff --git a/voucherify/models/vouchers_transactions_export_create_response_body_result.py b/voucherify/models/vouchers_transactions_export_create_response_body_result.py new file mode 100644 index 00000000..b9642ffc --- /dev/null +++ b/voucherify/models/vouchers_transactions_export_create_response_body_result.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersTransactionsExportCreateResponseBodyResult(BaseModel): + """ + Contains the URL of the CSV file. + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method.") + __properties: ClassVar[List[str]] = ["url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersTransactionsExportCreateResponseBodyResult 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, + ) + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersTransactionsExportCreateResponseBodyResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_transactions_list_response_body.py b/voucherify/models/vouchers_transactions_list_response_body.py new file mode 100644 index 00000000..a3663e3e --- /dev/null +++ b/voucherify/models/vouchers_transactions_list_response_body.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.voucher_transaction import VoucherTransaction +from typing import Optional, Set +from typing_extensions import Self + +class VouchersTransactionsListResponseBody(BaseModel): + """ + Response body schema for **GET** `v1/vouchers/{code}/transactions`. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented by JSON.") + data_ref: Optional[StrictStr] = Field(default='data', description="Identifies the name of the attribute that contains the array of transaction objects.") + data: Optional[List[VoucherTransaction]] = Field(default=None, description="A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.") + has_more: Optional[StrictBool] = Field(default=None, description="As query results are always limited (by the limit parameter), the `has_more` flag indicates if there are more records for given filter parameters. This lets you know if you can run another request (with a different paging or a different start date filter) to get more records returned in the results.") + more_starting_after: Optional[StrictStr] = Field(default=None, description="Returns an ID that can be used to return another page of results. Use the transaction ID in the `starting_after_id` query parameter to display another page of the results starting after the transaction with that ID.") + __properties: ClassVar[List[str]] = ["object", "data_ref", "data", "has_more", "more_starting_after"] + + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['list']): + raise ValueError("must be one of enum values ('list')") + return value + + @field_validator('data_ref') + def data_ref_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['data']): + raise ValueError("must be one of enum values ('data')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersTransactionsListResponseBody 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if data_ref (nullable) is None + # and model_fields_set contains the field + if self.data_ref is None and "data_ref" in self.model_fields_set: + _dict['data_ref'] = None + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if has_more (nullable) is None + # and model_fields_set contains the field + if self.has_more is None and "has_more" in self.model_fields_set: + _dict['has_more'] = None + + # set to None if more_starting_after (nullable) is None + # and model_fields_set contains the field + if self.more_starting_after is None and "more_starting_after" in self.model_fields_set: + _dict['more_starting_after'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersTransactionsListResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "data_ref": obj.get("data_ref") if obj.get("data_ref") is not None else 'data', + "data": [VoucherTransaction.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "has_more": obj.get("has_more"), + "more_starting_after": obj.get("more_starting_after") + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_in_bulk_item_request_body.py b/voucherify/models/vouchers_update_in_bulk_item_request_body.py new file mode 100644 index 00000000..f5f8190b --- /dev/null +++ b/voucherify/models/vouchers_update_in_bulk_item_request_body.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersUpdateInBulkItemRequestBody(BaseModel): + """ + VouchersUpdateInBulkItemRequestBody + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Unique voucher code.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + __properties: ClassVar[List[str]] = ["code", "metadata"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateInBulkItemRequestBody 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, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateInBulkItemRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "metadata": obj.get("metadata") + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_in_bulk_response_body.py b/voucherify/models/vouchers_update_in_bulk_response_body.py new file mode 100644 index 00000000..ba2bf2c0 --- /dev/null +++ b/voucherify/models/vouchers_update_in_bulk_response_body.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersUpdateInBulkResponseBody(BaseModel): + """ + Response body schema for **POST** `v1/vouchers/bulk/async`. + """ # noqa: E501 + async_action_id: Optional[StrictStr] = Field(default=None, description="The ID of the scheduled asynchronous action.") + __properties: ClassVar[List[str]] = ["async_action_id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateInBulkResponseBody 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, + ) + # set to None if async_action_id (nullable) is None + # and model_fields_set contains the field + if self.async_action_id is None and "async_action_id" in self.model_fields_set: + _dict['async_action_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateInBulkResponseBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "async_action_id": obj.get("async_action_id") + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_request_body.py b/voucherify/models/vouchers_update_request_body.py new file mode 100644 index 00000000..ab120bae --- /dev/null +++ b/voucherify/models/vouchers_update_request_body.py @@ -0,0 +1,196 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.discount import Discount +from voucherify.models.gift import Gift +from voucherify.models.simple_loyalty_card import SimpleLoyaltyCard +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from typing import Optional, Set +from typing_extensions import Self + +class VouchersUpdateRequestBody(BaseModel): + """ + VouchersUpdateRequestBody + """ # noqa: E501 + category: Optional[StrictStr] = Field(default=None, description="The name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique identifier assigned by Voucherify to the name of the category that this voucher belongs to. Useful when listing vouchers with the [List Vouchers](ref:list-vouchers) endpoint.") + start_date: Optional[datetime] = Field(default=None, description="Start date defines when the code starts to be active. Activation timestamp is presented in the ISO 8601 format. Voucher is *inactive before* this date.") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration date defines when the code expires. Expiration timestamp is presented in the ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = None + type: Optional[StrictStr] = None + loyalty_card: Optional[SimpleLoyaltyCard] = None + gift: Optional[Gift] = None + discount: Optional[Discount] = None + __properties: ClassVar[List[str]] = ["category", "category_id", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "type", "loyalty_card", "gift", "discount"] + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['LOYALTY_CARD', 'GIFT_VOUCHER', 'DISCOUNT_VOUCHER']): + raise ValueError("must be one of enum values ('LOYALTY_CARD', 'GIFT_VOUCHER', 'DISCOUNT_VOUCHER')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateRequestBody 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 validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "type": obj.get("type"), + "loyalty_card": SimpleLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "gift": Gift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_response_body.py b/voucherify/models/vouchers_update_response_body.py new file mode 100644 index 00000000..f7ce745b --- /dev/null +++ b/voucherify/models/vouchers_update_response_body.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from voucherify.models.category import Category +from voucherify.models.discount import Discount +from voucherify.models.validation_rules_assignments_list import ValidationRulesAssignmentsList +from voucherify.models.validity_hours import ValidityHours +from voucherify.models.validity_timeframe import ValidityTimeframe +from voucherify.models.voucher_assets import VoucherAssets +from voucherify.models.vouchers_update_response_body_gift import VouchersUpdateResponseBodyGift +from voucherify.models.vouchers_update_response_body_loyalty_card import VouchersUpdateResponseBodyLoyaltyCard +from voucherify.models.vouchers_update_response_body_publish import VouchersUpdateResponseBodyPublish +from voucherify.models.vouchers_update_response_body_redemption import VouchersUpdateResponseBodyRedemption +from typing import Optional, Set +from typing_extensions import Self + +class VouchersUpdateResponseBody(BaseModel): + """ + Response body schema for **PUT** `v1/vouchers/{code}`. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher.") + code: Optional[StrictStr] = Field(default=None, description="A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.") + campaign: Optional[StrictStr] = Field(default=None, description="A unique campaign name, identifies the voucher's parent campaign.") + campaign_id: Optional[StrictStr] = Field(default=None, description="Assigned by the Voucherify API, identifies the voucher's parent campaign.") + category: Optional[StrictStr] = Field(default=None, description="Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.") + category_id: Optional[StrictStr] = Field(default=None, description="Unique category ID assigned by Voucherify.") + type: Optional[StrictStr] = Field(default=None, description="Defines the type of the voucher. ") + discount: Optional[Discount] = None + gift: Optional[VouchersUpdateResponseBodyGift] = None + loyalty_card: Optional[VouchersUpdateResponseBodyLoyaltyCard] = None + start_date: Optional[datetime] = Field(default=None, description="Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ") + expiration_date: Optional[datetime] = Field(default=None, description="Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date.") + validity_timeframe: Optional[ValidityTimeframe] = None + validity_day_of_week: Optional[List[StrictInt]] = Field(default=None, description="Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday") + validity_hours: Optional[ValidityHours] = None + active: Optional[StrictBool] = Field(default=None, description="A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. - `true` indicates an *active* voucher - `false` indicates an *inactive* voucher") + additional_info: Optional[StrictStr] = Field(default=None, description="An optional field to keep any extra textual information about the code such as a code description and details.") + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.") + assets: Optional[VoucherAssets] = None + is_referral_code: Optional[StrictBool] = Field(default=None, description="Flag indicating whether this voucher is a referral code; `true` for campaign type `REFERRAL_PROGRAM`.") + created_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was created. The value is shown in the ISO 8601 format.") + updated_at: Optional[datetime] = Field(default=None, description="Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.") + holder_id: Optional[StrictStr] = Field(default=None, description="Unique customer identifier of the redeemable holder. It equals to the customer ID assigned by Voucherify.") + referrer_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the referring person.") + object: Optional[StrictStr] = Field(default='voucher', description="The type of the object represented by JSON. Default is `voucher`.") + publish: Optional[VouchersUpdateResponseBodyPublish] = None + redemption: Optional[VouchersUpdateResponseBodyRedemption] = None + categories: Optional[List[Category]] = Field(default=None, description="Contains details about the category.") + validation_rules_assignments: Optional[ValidationRulesAssignmentsList] = None + __properties: ClassVar[List[str]] = ["id", "code", "campaign", "campaign_id", "category", "category_id", "type", "discount", "gift", "loyalty_card", "start_date", "expiration_date", "validity_timeframe", "validity_day_of_week", "validity_hours", "active", "additional_info", "metadata", "assets", "is_referral_code", "created_at", "updated_at", "holder_id", "referrer_id", "object", "publish", "redemption", "categories", "validation_rules_assignments"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD']): + raise ValueError("must be one of enum values ('GIFT_VOUCHER', 'DISCOUNT_VOUCHER', 'LOYALTY_CARD')") + return value + + @field_validator('validity_day_of_week') + def validity_day_of_week_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set([0, 1, 2, 3, 4, 5, 6]): + raise ValueError("each list item must be one of (0, 1, 2, 3, 4, 5, 6)") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBody 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 discount + if self.discount: + _dict['discount'] = self.discount.to_dict() + # override the default output from pydantic by calling `to_dict()` of gift + if self.gift: + _dict['gift'] = self.gift.to_dict() + # override the default output from pydantic by calling `to_dict()` of loyalty_card + if self.loyalty_card: + _dict['loyalty_card'] = self.loyalty_card.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_timeframe + if self.validity_timeframe: + _dict['validity_timeframe'] = self.validity_timeframe.to_dict() + # override the default output from pydantic by calling `to_dict()` of validity_hours + if self.validity_hours: + _dict['validity_hours'] = self.validity_hours.to_dict() + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of publish + if self.publish: + _dict['publish'] = self.publish.to_dict() + # override the default output from pydantic by calling `to_dict()` of redemption + if self.redemption: + _dict['redemption'] = self.redemption.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + # override the default output from pydantic by calling `to_dict()` of validation_rules_assignments + if self.validation_rules_assignments: + _dict['validation_rules_assignments'] = self.validation_rules_assignments.to_dict() + # set to None if id (nullable) is None + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: + _dict['id'] = None + + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if campaign (nullable) is None + # and model_fields_set contains the field + if self.campaign is None and "campaign" in self.model_fields_set: + _dict['campaign'] = None + + # set to None if campaign_id (nullable) is None + # and model_fields_set contains the field + if self.campaign_id is None and "campaign_id" in self.model_fields_set: + _dict['campaign_id'] = None + + # set to None if category (nullable) is None + # and model_fields_set contains the field + if self.category is None and "category" in self.model_fields_set: + _dict['category'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if type (nullable) is None + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: + _dict['type'] = None + + # set to None if gift (nullable) is None + # and model_fields_set contains the field + if self.gift is None and "gift" in self.model_fields_set: + _dict['gift'] = None + + # set to None if loyalty_card (nullable) is None + # and model_fields_set contains the field + if self.loyalty_card is None and "loyalty_card" in self.model_fields_set: + _dict['loyalty_card'] = None + + # set to None if start_date (nullable) is None + # and model_fields_set contains the field + if self.start_date is None and "start_date" in self.model_fields_set: + _dict['start_date'] = None + + # set to None if expiration_date (nullable) is None + # and model_fields_set contains the field + if self.expiration_date is None and "expiration_date" in self.model_fields_set: + _dict['expiration_date'] = None + + # set to None if active (nullable) is None + # and model_fields_set contains the field + if self.active is None and "active" in self.model_fields_set: + _dict['active'] = None + + # set to None if additional_info (nullable) is None + # and model_fields_set contains the field + if self.additional_info is None and "additional_info" in self.model_fields_set: + _dict['additional_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + + # set to None if is_referral_code (nullable) is None + # and model_fields_set contains the field + if self.is_referral_code is None and "is_referral_code" in self.model_fields_set: + _dict['is_referral_code'] = None + + # set to None if created_at (nullable) is None + # and model_fields_set contains the field + if self.created_at is None and "created_at" in self.model_fields_set: + _dict['created_at'] = None + + # set to None if updated_at (nullable) is None + # and model_fields_set contains the field + if self.updated_at is None and "updated_at" in self.model_fields_set: + _dict['updated_at'] = None + + # set to None if holder_id (nullable) is None + # and model_fields_set contains the field + if self.holder_id is None and "holder_id" in self.model_fields_set: + _dict['holder_id'] = None + + # set to None if referrer_id (nullable) is None + # and model_fields_set contains the field + if self.referrer_id is None and "referrer_id" in self.model_fields_set: + _dict['referrer_id'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if publish (nullable) is None + # and model_fields_set contains the field + if self.publish is None and "publish" in self.model_fields_set: + _dict['publish'] = None + + # set to None if redemption (nullable) is None + # and model_fields_set contains the field + if self.redemption is None and "redemption" in self.model_fields_set: + _dict['redemption'] = None + + # set to None if categories (nullable) is None + # and model_fields_set contains the field + if self.categories is None and "categories" in self.model_fields_set: + _dict['categories'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBody 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"), + "code": obj.get("code"), + "campaign": obj.get("campaign"), + "campaign_id": obj.get("campaign_id"), + "category": obj.get("category"), + "category_id": obj.get("category_id"), + "type": obj.get("type"), + "discount": Discount.from_dict(obj["discount"]) if obj.get("discount") is not None else None, + "gift": VouchersUpdateResponseBodyGift.from_dict(obj["gift"]) if obj.get("gift") is not None else None, + "loyalty_card": VouchersUpdateResponseBodyLoyaltyCard.from_dict(obj["loyalty_card"]) if obj.get("loyalty_card") is not None else None, + "start_date": obj.get("start_date"), + "expiration_date": obj.get("expiration_date"), + "validity_timeframe": ValidityTimeframe.from_dict(obj["validity_timeframe"]) if obj.get("validity_timeframe") is not None else None, + "validity_day_of_week": obj.get("validity_day_of_week"), + "validity_hours": ValidityHours.from_dict(obj["validity_hours"]) if obj.get("validity_hours") is not None else None, + "active": obj.get("active"), + "additional_info": obj.get("additional_info"), + "metadata": obj.get("metadata"), + "assets": VoucherAssets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "is_referral_code": obj.get("is_referral_code"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "holder_id": obj.get("holder_id"), + "referrer_id": obj.get("referrer_id"), + "object": obj.get("object") if obj.get("object") is not None else 'voucher', + "publish": VouchersUpdateResponseBodyPublish.from_dict(obj["publish"]) if obj.get("publish") is not None else None, + "redemption": VouchersUpdateResponseBodyRedemption.from_dict(obj["redemption"]) if obj.get("redemption") is not None else None, + "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "validation_rules_assignments": ValidationRulesAssignmentsList.from_dict(obj["validation_rules_assignments"]) if obj.get("validation_rules_assignments") is not None else None + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_response_body_gift.py b/voucherify/models/vouchers_update_response_body_gift.py new file mode 100644 index 00000000..4cdda32b --- /dev/null +++ b/voucherify/models/vouchers_update_response_body_gift.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 + +class VouchersUpdateResponseBodyGift(BaseModel): + """ + Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`. + """ # noqa: E501 + amount: Optional[StrictInt] = Field(default=None, description="Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + balance: Optional[StrictInt] = Field(default=None, description="Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.") + effect: Optional[StrictStr] = Field(default=None, description="Defines how the credits are applied to the customer's order.") + __properties: ClassVar[List[str]] = ["amount", "balance", "effect"] + + @field_validator('effect') + def effect_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['APPLY_TO_ORDER', 'APPLY_TO_ITEMS']): + raise ValueError("must be one of enum values ('APPLY_TO_ORDER', 'APPLY_TO_ITEMS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyGift 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, + ) + # set to None if amount (nullable) is None + # and model_fields_set contains the field + if self.amount is None and "amount" in self.model_fields_set: + _dict['amount'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if effect (nullable) is None + # and model_fields_set contains the field + if self.effect is None and "effect" in self.model_fields_set: + _dict['effect'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyGift from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "effect": obj.get("effect") + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_response_body_loyalty_card.py b/voucherify/models/vouchers_update_response_body_loyalty_card.py new file mode 100644 index 00000000..82a33fa2 --- /dev/null +++ b/voucherify/models/vouchers_update_response_body_loyalty_card.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 date +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersUpdateResponseBodyLoyaltyCard(BaseModel): + """ + Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`. + """ # noqa: E501 + points: Optional[StrictInt] = Field(default=None, description="Total points incurred over the lifespan of the loyalty card.") + balance: Optional[StrictInt] = Field(default=None, description="Points available for reward redemption.") + next_expiration_date: Optional[date] = Field(default=None, description="The next closest date when the next set of points are due to expire.") + next_expiration_points: Optional[StrictInt] = Field(default=None, description="The amount of points that are set to expire next.") + __properties: ClassVar[List[str]] = ["points", "balance", "next_expiration_date", "next_expiration_points"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyLoyaltyCard 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, + ) + # set to None if points (nullable) is None + # and model_fields_set contains the field + if self.points is None and "points" in self.model_fields_set: + _dict['points'] = None + + # set to None if balance (nullable) is None + # and model_fields_set contains the field + if self.balance is None and "balance" in self.model_fields_set: + _dict['balance'] = None + + # set to None if next_expiration_date (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_date is None and "next_expiration_date" in self.model_fields_set: + _dict['next_expiration_date'] = None + + # set to None if next_expiration_points (nullable) is None + # and model_fields_set contains the field + if self.next_expiration_points is None and "next_expiration_points" in self.model_fields_set: + _dict['next_expiration_points'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyLoyaltyCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "points": obj.get("points"), + "balance": obj.get("balance"), + "next_expiration_date": obj.get("next_expiration_date"), + "next_expiration_points": obj.get("next_expiration_points") + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_response_body_publish.py b/voucherify/models/vouchers_update_response_body_publish.py new file mode 100644 index 00000000..fbbfbf2f --- /dev/null +++ b/voucherify/models/vouchers_update_response_body_publish.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersUpdateResponseBodyPublish(BaseModel): + """ + Stores a summary of publication events: an event counter and endpoint to return details of each event. Publication is an assignment of a code to a customer, e.g. through a distribution. + """ # noqa: E501 + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute.") + count: Optional[StrictInt] = Field(default=None, description="Publication events counter.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`") + __properties: ClassVar[List[str]] = ["object", "count", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyPublish 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, + ) + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict['count'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyPublish from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "object": obj.get("object") if obj.get("object") is not None else 'list', + "count": obj.get("count"), + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/models/vouchers_update_response_body_redemption.py b/voucherify/models/vouchers_update_response_body_redemption.py new file mode 100644 index 00000000..ce7c5c63 --- /dev/null +++ b/voucherify/models/vouchers_update_response_body_redemption.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VouchersUpdateResponseBodyRedemption(BaseModel): + """ + Stores a summary of redemptions that have been applied to the voucher. + """ # noqa: E501 + quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher can be redeemed. A `null` value means unlimited.") + redeemed_quantity: Optional[StrictInt] = Field(default=None, description="How many times a voucher has already been redeemed.") + redeemed_points: Optional[StrictInt] = Field(default=None, description="Total loyalty points redeemed.") + object: Optional[StrictStr] = Field(default='list', description="The type of the object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute.") + url: Optional[StrictStr] = Field(default=None, description="The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`") + __properties: ClassVar[List[str]] = ["quantity", "redeemed_quantity", "redeemed_points", "object", "url"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyRedemption 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, + ) + # set to None if quantity (nullable) is None + # and model_fields_set contains the field + if self.quantity is None and "quantity" in self.model_fields_set: + _dict['quantity'] = None + + # set to None if redeemed_quantity (nullable) is None + # and model_fields_set contains the field + if self.redeemed_quantity is None and "redeemed_quantity" in self.model_fields_set: + _dict['redeemed_quantity'] = None + + # set to None if redeemed_points (nullable) is None + # and model_fields_set contains the field + if self.redeemed_points is None and "redeemed_points" in self.model_fields_set: + _dict['redeemed_points'] = None + + # set to None if object (nullable) is None + # and model_fields_set contains the field + if self.object is None and "object" in self.model_fields_set: + _dict['object'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VouchersUpdateResponseBodyRedemption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "redeemed_quantity": obj.get("redeemed_quantity"), + "redeemed_points": obj.get("redeemed_points"), + "object": obj.get("object") if obj.get("object") is not None else 'list', + "url": obj.get("url") + }) + return _obj + + diff --git a/voucherify/py.typed b/voucherify/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/voucherify/rest.py b/voucherify/rest.py new file mode 100644 index 00000000..c4ddea95 --- /dev/null +++ b/voucherify/rest.py @@ -0,0 +1,258 @@ +# coding: utf-8 + +""" + Voucherify API + + Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. + + The version of the OpenAPI document: v2018-08-01 + Contact: support@voucherify.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl + +import urllib3 + +from voucherify.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy: + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :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 + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, float)): + timeout = urllib3.Timeout(total=_request_timeout) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # Pass a `string` parameter directly in the body to support + # other content types than JSON when `body` argument is + # provided in serialized form. + elif isinstance(body, str) or isinstance(body, bytes): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/voucherify/utils.py b/voucherify/utils.py deleted file mode 100644 index a69e27e5..00000000 --- a/voucherify/utils.py +++ /dev/null @@ -1,87 +0,0 @@ -from __future__ import division - -def round_money(value): - if value is None or value < 0: - raise Exception('Invalid value, amount should be a number and higher than zero.') - return round(value, 2) - - -def validate_percent_discount(discount): - if discount is None or discount < 0 or discount > 100: - raise Exception('Invalid voucher, percent discount should be between 0-100.') - - -def validate_amount_discount(discount=None): - if discount is None or discount < 0: - raise Exception('Invalid voucher, amount discount must be higher than zero.') - - -def validate_unit_discount(discount=None): - if discount is None or discount < 0: - raise Exception('Invalid voucher, unit discount must be higher than zero.') - - -def calculate_price(base_price, voucher, unit_price): - e = 100 - - if getattr(voucher, 'gift', None) is not None: - discount = min(voucher['gift']['balance'] / e, base_price) - return round_money(base_price - discount) - - if 'discount' not in voucher: - raise Exception('Unsupported voucher type.') - - if voucher['discount']['type'] == 'PERCENT': - discount = voucher['discount']['percent_off'] - validate_percent_discount(discount) - price_discount = base_price * (discount / 100) - return round_money(base_price - price_discount) - - elif voucher['discount']['type'] == 'AMOUNT': - discount = voucher['discount']['amount_off'] / e - validate_amount_discount(discount) - new_price = base_price - discount - return round_money(new_price if new_price > 0 else 0) - - elif voucher['discount']['type'] == 'UNIT': - discount = voucher['discount']['unit_off'] - validate_unit_discount(discount) - new_price = base_price - unit_price * discount - return round_money(new_price if new_price > 0 else 0) - - else: - raise Exception('Unsupported discount type.') - - -def calculate_discount(base_price, voucher, unit_price): - e = 100 - - if getattr(voucher, 'gift', None) is not None: - discount = min(voucher['gift']['balance'] / e, base_price) - return round_money(discount) - - if 'discount' not in voucher: - raise Exception('Unsupported voucher type.') - - if voucher['discount']['type'] == 'PERCENT': - discount = voucher['discount']['percent_off'] - validate_percent_discount(discount) - return round_money(base_price * (discount / 100)) - - elif voucher['discount']['type'] == 'AMOUNT': - discount = voucher['discount']['amount_off'] / e - validate_amount_discount(discount) - new_price = base_price - discount - return round_money(discount if new_price > 0 else base_price) - - elif voucher['discount']['type'] == 'UNIT': - discount = voucher['discount']['unit_off'] - validate_unit_discount(discount) - price_discount = unit_price * discount - return round_money(base_price if price_discount > base_price else price_discount) - - else: - raise Exception('Unsupported discount type.') - - -__all__ = ['calculate_price', 'calculate_discount']